From c7ac26ed6118cb8f2ea6ed9d7d6e0ca3421d84ea Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:08:07 +0000 Subject: [PATCH] feat: Expose supported languages of the agent; feat: add export / import flow API docs: Update docs on Pages, Session, Version, etc. (#104) PiperOrigin-RevId: 370928139 Source-Link: https://github.com/googleapis/googleapis/commit/0fa726c5d8e4b8442f49974abc875db1af432316 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e3f4a8826f719a70b157dd3dc92ca97b7f0e9547 --- .../cloud/dialogflow/cx/v3beta1/agent.proto | 14 + .../dialogflow/cx/v3beta1/experiment.proto | 2 +- .../cloud/dialogflow/cx/v3beta1/flow.proto | 122 ++ .../cloud/dialogflow/cx/v3beta1/page.proto | 40 +- .../cloud/dialogflow/cx/v3beta1/session.proto | 207 ++-- .../cx/v3beta1/transition_route_group.proto | 34 +- .../cloud/dialogflow/cx/v3beta1/version.proto | 12 +- protos/protos.d.ts | 466 +++++++ protos/protos.js | 1098 +++++++++++++++++ protos/protos.json | 159 +++ src/v3beta1/agents_client.ts | 4 + src/v3beta1/flows_client.ts | 341 +++++ src/v3beta1/flows_client_config.json | 10 + src/v3beta1/gapic_metadata.json | 20 + src/v3beta1/pages_client.ts | 60 +- src/v3beta1/sessions_client.ts | 15 +- src/v3beta1/transition_route_groups_client.ts | 52 +- src/v3beta1/versions_client.ts | 12 +- test/gapic_flows_v3beta1.ts | 382 ++++++ 19 files changed, 2900 insertions(+), 150 deletions(-) diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto b/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto index b1422276..1824e0b2 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto @@ -166,6 +166,10 @@ message Agent { // This field cannot be set by the [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent] method. string default_language_code = 3 [(google.api.field_behavior) = IMMUTABLE]; + // The list of all languages supported by the agent (except for the + // `default_language_code`). + repeated string supported_language_codes = 4; + // Required. The time zone of the agent from the [time zone // database](https://www.iana.org/time-zones), e.g., America/New_York, // Europe/Paris. @@ -306,6 +310,16 @@ message ExportAgentRequest { // `gs:///`. // If left unspecified, the serialized agent is returned inline. string agent_uri = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Environment name. If not set, draft environment is assumed. + // Format: `projects//locations//agents//environments/`. + string environment = 5 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; } // The response message for [Agents.ExportAgent][google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgent]. diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/experiment.proto b/protos/google/cloud/dialogflow/cx/v3beta1/experiment.proto index ec9db312..581da8d8 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/experiment.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/experiment.proto @@ -174,7 +174,7 @@ message Experiment { // Version variant and associated metrics. message VersionMetrics { // The name of the flow [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - // Format: `projects//locations//locations//agents//flows//versions/`. string version = 1 [(google.api.resource_reference) = { type: "dialogflow.googleapis.com/Version" diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto b/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto index 08861181..68c1d792 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto @@ -116,6 +116,33 @@ service Flows { }; option (google.api.method_signature) = "name"; } + + // Imports the specified flow to the specified agent from a binary file. + rpc ImportFlow(ImportFlowRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows:import" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "ImportFlowResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Exports the specified flow to a binary file. + // + // Note that resources (e.g. intents, entities, webhooks) that the flow + // references will also be exported. + rpc ExportFlow(ExportFlowRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}:export" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "ExportFlowResponse" + metadata_type: "google.protobuf.Struct" + }; + } } // Settings related to NLU. @@ -260,7 +287,9 @@ message CreateFlowRequest { // The language of the following fields in `flow`: // // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.event_handlers.trigger_fulfillment.conditional_cases` // * `Flow.transition_routes.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -317,7 +346,9 @@ message ListFlowsRequest { // dependent: // // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.event_handlers.trigger_fulfillment.conditional_cases` // * `Flow.transition_routes.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -354,7 +385,9 @@ message GetFlowRequest { // dependent: // // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.event_handlers.trigger_fulfillment.conditional_cases` // * `Flow.transition_routes.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -376,7 +409,9 @@ message UpdateFlowRequest { // The language of the following fields in `flow`: // // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.event_handlers.trigger_fulfillment.conditional_cases` // * `Flow.transition_routes.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -449,3 +484,90 @@ message FlowValidationResult { // Last time the flow was validated. google.protobuf.Timestamp update_time = 3; } + +// The request message for [Flows.ImportFlow][google.cloud.dialogflow.cx.v3beta1.Flows.ImportFlow]. +message ImportFlowRequest { + // Import option. + enum ImportOption { + // Unspecified. Treated as `KEEP`. + IMPORT_OPTION_UNSPECIFIED = 0; + + // Always respect settings in exported flow content. It may cause a + // import failure if some settings (e.g. custom NLU) are not supported in + // the agent to import into. + KEEP = 1; + + // Fallback to default settings if some settings are not supported in the + // agent to import into. E.g. Standard NLU will be used if custom NLU is + // not available. + FALLBACK = 2; + } + + // Required. The agent to import the flow into. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Flow" + } + ]; + + // Required. The flow to import. + oneof flow { + // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + // to import flow from. The format of this URI must be + // `gs:///`. + string flow_uri = 2; + + // Uncompressed raw byte content for flow. + bytes flow_content = 3; + } + + // Flow import mode. If not specified, `KEEP` is assumed. + ImportOption import_option = 4; +} + +// The response message for [Flows.ImportFlow][google.cloud.dialogflow.cx.v3beta1.Flows.ImportFlow]. +message ImportFlowResponse { + // The unique identifier of the new flow. + // Format: `projects//locations//agents//flows/`. + string flow = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + }]; +} + +// The request message for [Flows.ExportFlow][google.cloud.dialogflow.cx.v3beta1.Flows.ExportFlow]. +message ExportFlowRequest { + // Required. The name of the flow to export. + // Format: `projects//locations//agents//flows/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + } + ]; + + // Optional. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + // export the flow to. The format of this URI must be + // `gs:///`. + // If left unspecified, the serialized flow is returned inline. + string flow_uri = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether to export flows referenced by the specified flow. + bool include_referenced_flows = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Flows.ExportFlow][google.cloud.dialogflow.cx.v3beta1.Flows.ExportFlow]. +message ExportFlowResponse { + // The exported flow. + oneof flow { + // The URI to a file containing the exported flow. This field is populated + // only if `flow_uri` is specified in [ExportFlowRequest][google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest]. + string flow_uri = 1; + + // Uncompressed raw byte content for flow. + bytes flow_content = 2; + } +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/page.proto b/protos/google/cloud/dialogflow/cx/v3beta1/page.proto index 4a8acf7a..bfcc08e6 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/page.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/page.proto @@ -378,11 +378,17 @@ message ListPagesRequest { // dependent: // // * `Page.entry_fulfillment.messages` + // * `Page.entry_fulfillment.conditional_cases` + // * `Page.event_handlers.trigger_fulfillment.messages` + // * `Page.event_handlers.trigger_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * + // `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - // * `Page.transition_routes.trigger_fulfillment.messages` // * - // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * `Page.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -426,11 +432,17 @@ message GetPageRequest { // dependent: // // * `Page.entry_fulfillment.messages` + // * `Page.entry_fulfillment.conditional_cases` + // * `Page.event_handlers.trigger_fulfillment.messages` + // * `Page.event_handlers.trigger_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * + // `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - // * `Page.transition_routes.trigger_fulfillment.messages` // * - // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * `Page.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -458,11 +470,17 @@ message CreatePageRequest { // The language of the following fields in `page`: // // * `Page.entry_fulfillment.messages` + // * `Page.entry_fulfillment.conditional_cases` + // * `Page.event_handlers.trigger_fulfillment.messages` + // * `Page.event_handlers.trigger_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * + // `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - // * `Page.transition_routes.trigger_fulfillment.messages` // * - // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * `Page.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -480,11 +498,17 @@ message UpdatePageRequest { // The language of the following fields in `page`: // // * `Page.entry_fulfillment.messages` + // * `Page.entry_fulfillment.conditional_cases` + // * `Page.event_handlers.trigger_fulfillment.messages` + // * `Page.event_handlers.trigger_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * + // `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - // * `Page.transition_routes.trigger_fulfillment.messages` // * - // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * `Page.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/session.proto b/protos/google/cloud/dialogflow/cx/v3beta1/session.proto index f331f1a2..0a79181a 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/session.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/session.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package google.cloud.dialogflow.cx.v3beta1; 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/cx/v3beta1/audio_config.proto"; @@ -29,7 +30,6 @@ import "google/protobuf/duration.proto"; import "google/protobuf/struct.proto"; import "google/rpc/status.proto"; import "google/type/latlng.proto"; -import "google/api/client.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; @@ -45,8 +45,9 @@ option (google.api.resource_definition) = { }; // A session represents an interaction with a user. You retrieve user input -// and pass it to the [DetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent] method to determine -// user intent and respond. +// and pass it to the +// [DetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent] +// method to determine user intent and respond. service Sessions { option (google.api.default_host) = "dialogflow.googleapis.com"; option (google.api.oauth_scopes) = @@ -79,8 +80,8 @@ service Sessions { // Note: Always use agent versions for production traffic. // See [Versions and // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). - rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { - } + rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) + returns (stream StreamingDetectIntentResponse) {} // Returns preliminary intent match results, doesn't change the session // status. @@ -95,9 +96,13 @@ service Sessions { }; } - // Fulfills a matched intent returned by [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent]. - // Must be called after [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent], with input from - // [MatchIntentResponse][google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse]. Otherwise, the behavior is undefined. + // Fulfills a matched intent returned by + // [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent]. + // Must be called after + // [MatchIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent], + // with input from + // [MatchIntentResponse][google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse]. + // Otherwise, the behavior is undefined. rpc FulfillIntent(FulfillIntentRequest) returns (FulfillIntentResponse) { option (google.api.http) = { post: "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/sessions/*}:fulfillIntent" @@ -157,9 +162,9 @@ message DetectIntentResponse { // 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.response_messages`][google.cloud.dialogflow.cx.v3beta1.QueryResult.response_messages] field. If - // multiple default text responses exist, they will be concatenated when - // generating audio. If no default platform text responses exist, the + // [`query_result.response_messages`][google.cloud.dialogflow.cx.v3beta1.QueryResult.response_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 @@ -172,24 +177,29 @@ message DetectIntentResponse { } // The top-level message sent by the client to the -// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntent] method. +// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntent] +// method. // // Multiple request messages should be sent in order: // // 1. The first message must contain // [session][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.session], -// [query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input] plus optionally -// [query_params][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_params]. If the client -// wants to receive an audio response, it should also contain +// [query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input] +// plus optionally +// [query_params][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_params]. +// If the client wants to receive an audio response, it should also contain // [output_audio_config][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.output_audio_config]. // -// 2. If [query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input] was set to -// [query_input.audio.config][google.cloud.dialogflow.cx.v3beta1.AudioInput.config], all subsequent messages -// must contain [query_input.audio.audio][google.cloud.dialogflow.cx.v3beta1.AudioInput.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.cx.v3beta1.QueryInput.text]. +// 2. If +// [query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input] +// was set to +// [query_input.audio.config][google.cloud.dialogflow.cx.v3beta1.AudioInput.config], +// all subsequent messages must contain +// [query_input.audio.audio][google.cloud.dialogflow.cx.v3beta1.AudioInput.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.cx.v3beta1.QueryInput.text]. // // However, note that: // @@ -218,8 +228,8 @@ message StreamingDetectIntentRequest { // See [Versions and // environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). string session = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Session" - }]; + type: "dialogflow.googleapis.com/Session" + }]; // The parameters of this query. QueryParameters query_params = 2; @@ -240,7 +250,12 @@ message StreamingDetectIntentRequest { // complete transcript of what the user said. The last `recognition_result` // has `is_final` set to `true`. // -// 2. The last message contains `detect_intent_response`. +// 2. If `enable_partial_response` is true, the following N messages +// (currently 1 <= N <= 4) contain `detect_intent_response`. The first (N-1) +// `detect_intent_response`s will have `response_type` set to `PARTIAL`. +// The last `detect_intent_response` has `response_type` set to `FINAL`. +// If `response_type` is false, response stream only contains +// the final `detect_intent_response`. message StreamingDetectIntentResponse { // The output response. oneof response { @@ -300,8 +315,8 @@ message StreamingRecognitionResult { // 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`][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.single_utterance] was set to - // `true`, and is not used otherwise. + // [`single_utterance`][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.single_utterance] + // was set to `true`, and is not used otherwise. END_OF_SINGLE_UTTERANCE = 2; } @@ -337,7 +352,8 @@ message StreamingRecognitionResult { float stability = 6; // Word-specific information for the words recognized by Speech in - // [transcript][google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and + // [transcript][google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.transcript]. + // Populated if and only if `message_type` = `TRANSCRIPT` and // [InputAudioConfig.enable_word_info] is set. repeated SpeechWordInfo speech_word_info = 7; @@ -365,6 +381,17 @@ message QueryParameters { // This field can be used to pass custom data into the webhook associated with // the agent. Arbitrary JSON objects are supported. + // 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" + // } + // } + // ``` google.protobuf.Struct payload = 4; // Additional parameters to be put into [session @@ -388,7 +415,8 @@ message QueryParameters { // - Else: parameter value google.protobuf.Struct parameters = 5; - // The unique identifier of the [page][google.cloud.dialogflow.cx.v3beta1.Page] to override the [current + // The unique identifier of the + // [page][google.cloud.dialogflow.cx.v3beta1.Page] to override the [current // page][QueryResult.current_page] in the session. Format: `projects//locations//agents//pages/`. // @@ -396,12 +424,14 @@ message QueryParameters { // ignored by Dialogflow, including the [previous // page][QueryResult.current_page] and the [previous session // parameters][QueryResult.parameters]. - // In most cases, [current_page][google.cloud.dialogflow.cx.v3beta1.QueryParameters.current_page] and - // [parameters][google.cloud.dialogflow.cx.v3beta1.QueryParameters.parameters] should be configured together to - // direct a session to a specific state. - string current_page = 6 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Page" - }]; + // In most cases, + // [current_page][google.cloud.dialogflow.cx.v3beta1.QueryParameters.current_page] + // and + // [parameters][google.cloud.dialogflow.cx.v3beta1.QueryParameters.parameters] + // should be configured together to direct a session to a specific state. + string current_page = 6 [ + (google.api.resource_reference) = { type: "dialogflow.googleapis.com/Page" } + ]; // Whether to disable webhook calls for this request. bool disable_webhook = 7; @@ -461,24 +491,25 @@ message QueryInput { message QueryResult { // The original conversational query. oneof query { - // If [natural language text][google.cloud.dialogflow.cx.v3beta1.TextInput] was provided as input, this field - // will contain a copy of the text. + // If [natural language text][google.cloud.dialogflow.cx.v3beta1.TextInput] + // was provided as input, this field will contain a copy of the text. string text = 1; - // If an [intent][google.cloud.dialogflow.cx.v3beta1.IntentInput] was provided as input, this field will - // contain a copy of the intent identifier. - // Format: `projects//locations//agents//intents/`. + // If an [intent][google.cloud.dialogflow.cx.v3beta1.IntentInput] was + // provided as input, this field will contain a copy of the intent + // identifier. Format: `projects//locations//agents//intents/`. string trigger_intent = 11 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - }]; + type: "dialogflow.googleapis.com/Intent" + }]; - // If [natural language speech audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as input, - // this field will contain the transcript for the audio. + // If [natural language speech + // audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as + // input, this field will contain the transcript for the audio. string transcript = 12; - // If an [event][google.cloud.dialogflow.cx.v3beta1.EventInput] was provided as input, this field will contain - // the name of the event. + // If an [event][google.cloud.dialogflow.cx.v3beta1.EventInput] was provided + // as input, this field will contain the name of the event. string trigger_event = 14; } @@ -488,7 +519,8 @@ message QueryResult { // for a list of the currently supported language codes. string language_code = 2; - // The collected [session parameters][google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters]. + // The collected [session + // parameters][google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters]. // // Depending on your protocol or client library language, this is a // map, associative array, symbol table, dictionary, or JSON object @@ -514,19 +546,23 @@ message QueryResult { // The list of webhook call status in the order of call sequence. repeated google.rpc.Status webhook_statuses = 13; - // The list of webhook payload in [WebhookResponse.payload][google.cloud.dialogflow.cx.v3beta1.WebhookResponse.payload], in - // the order of call sequence. If some webhook call fails or doesn't return + // The list of webhook payload in + // [WebhookResponse.payload][google.cloud.dialogflow.cx.v3beta1.WebhookResponse.payload], + // in the order of call sequence. If some webhook call fails or doesn't return // any payload, an empty `Struct` would be used instead. repeated google.protobuf.Struct webhook_payloads = 6; - // The current [Page][google.cloud.dialogflow.cx.v3beta1.Page]. Some, not all fields are filled in this message, - // including but not limited to `name` and `display_name`. + // The current [Page][google.cloud.dialogflow.cx.v3beta1.Page]. Some, not all + // fields are filled in this message, including but not limited to `name` and + // `display_name`. Page current_page = 7; - // The [Intent][google.cloud.dialogflow.cx.v3beta1.Intent] that matched the conversational query. Some, not all fields - // are filled in this message, including but not limited to: `name` and - // `display_name`. - // This field is deprecated, please use [QueryResult.match][google.cloud.dialogflow.cx.v3beta1.QueryResult.match] instead. + // The [Intent][google.cloud.dialogflow.cx.v3beta1.Intent] that matched the + // conversational query. Some, not all fields are filled in this message, + // including but not limited to: `name` and `display_name`. This field is + // deprecated, please use + // [QueryResult.match][google.cloud.dialogflow.cx.v3beta1.QueryResult.match] + // instead. Intent intent = 8 [deprecated = true]; // The intent detection confidence. Values range from 0.0 (completely @@ -535,7 +571,9 @@ message QueryResult { // 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. - // This field is deprecated, please use [QueryResult.match][google.cloud.dialogflow.cx.v3beta1.QueryResult.match] instead. + // This field is deprecated, please use + // [QueryResult.match][google.cloud.dialogflow.cx.v3beta1.QueryResult.match] + // instead. float intent_detection_confidence = 9 [deprecated = true]; // Intent match result, could be an intent or an event. @@ -548,14 +586,15 @@ message QueryResult { // The sentiment analyss result, which depends on // [`analyze_query_text_sentiment`] - // [google.cloud.dialogflow.cx.v3beta1.QueryParameters.analyze_query_text_sentiment], specified in the request. + // [google.cloud.dialogflow.cx.v3beta1.QueryParameters.analyze_query_text_sentiment], + // specified in the request. SentimentAnalysisResult sentiment_analysis_result = 17; } // 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. + // Required. The UTF-8 encoded natural language text to be processed. Text + // length must not exceed 256 characters. string text = 1 [(google.api.field_behavior) = REQUIRED]; } @@ -580,8 +619,9 @@ message AudioInput { // The natural language speech audio to be processed. // A single request can contain up to 1 minute of speech audio data. - // The [transcribed text][google.cloud.dialogflow.cx.v3beta1.QueryResult.transcript] cannot contain more than 256 - // bytes. + // The [transcribed + // text][google.cloud.dialogflow.cx.v3beta1.QueryResult.transcript] cannot + // contain more than 256 bytes. // // For non-streaming audio detect intent, both `config` and `audio` must be // provided. @@ -631,9 +671,10 @@ message Match { EVENT = 6; } - // The [Intent][google.cloud.dialogflow.cx.v3beta1.Intent] that matched the query. Some, not all fields are filled in - // this message, including but not limited to: `name` and `display_name`. Only - // filled for [`INTENT`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] match type. + // The [Intent][google.cloud.dialogflow.cx.v3beta1.Intent] that matched the + // query. Some, not all fields are filled in this message, including but not + // limited to: `name` and `display_name`. Only filled for + // [`INTENT`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] match type. Intent intent = 1; // The event that matched the query. Only filled for @@ -707,24 +748,25 @@ message MatchIntentRequest { message MatchIntentResponse { // The original conversational query. oneof query { - // If [natural language text][google.cloud.dialogflow.cx.v3beta1.TextInput] was provided as input, this field - // will contain a copy of the text. + // If [natural language text][google.cloud.dialogflow.cx.v3beta1.TextInput] + // was provided as input, this field will contain a copy of the text. string text = 1; - // If an [intent][google.cloud.dialogflow.cx.v3beta1.IntentInput] was provided as input, this field will - // contain a copy of the intent identifier. - // Format: `projects//locations//agents//intents/`. + // If an [intent][google.cloud.dialogflow.cx.v3beta1.IntentInput] was + // provided as input, this field will contain a copy of the intent + // identifier. Format: `projects//locations//agents//intents/`. string trigger_intent = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - }]; + type: "dialogflow.googleapis.com/Intent" + }]; - // If [natural language speech audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as input, - // this field will contain the transcript for the audio. + // If [natural language speech + // audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as + // input, this field will contain the transcript for the audio. string transcript = 3; - // If an [event][google.cloud.dialogflow.cx.v3beta1.EventInput] was provided as input, this field will - // contain a copy of the event name. + // If an [event][google.cloud.dialogflow.cx.v3beta1.EventInput] was provided + // as input, this field will contain a copy of the event name. string trigger_event = 6; } @@ -732,8 +774,9 @@ message MatchIntentResponse { // we have that the particular intent matches the query. repeated Match matches = 4; - // The current [Page][google.cloud.dialogflow.cx.v3beta1.Page]. Some, not all fields are filled in this message, - // including but not limited to `name` and `display_name`. + // The current [Page][google.cloud.dialogflow.cx.v3beta1.Page]. Some, not all + // fields are filled in this message, including but not limited to `name` and + // `display_name`. Page current_page = 5; } @@ -762,9 +805,9 @@ message FulfillIntentResponse { // 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.response_messages`][google.cloud.dialogflow.cx.v3beta1.QueryResult.response_messages] field. If - // multiple default text responses exist, they will be concatenated when - // generating audio. If no default platform text responses exist, the + // [`query_result.response_messages`][google.cloud.dialogflow.cx.v3beta1.QueryResult.response_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 diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto b/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto index 341985b4..f116ce12 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto @@ -124,9 +124,12 @@ message ListTransitionRouteGroupsRequest { // The next_page_token value returned from a previous list request. string page_token = 3; - // The language to list transition route groups for. The field - // [`messages`][TransitionRoute.trigger_fulfillment.messages] in - // [TransitionRoute][google.cloud.dialogflow.cx.v3beta1.TransitionRoute] is language dependent. + // The language to list transition route groups for. The following fields are + // language dependent: + // + // * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + // * + // `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -161,9 +164,12 @@ message GetTransitionRouteGroupRequest { } ]; - // The language to list transition route groups for. The field - // [`messages`][TransitionRoute.trigger_fulfillment.messages] in - // [TransitionRoute][google.cloud.dialogflow.cx.v3beta1.TransitionRoute] is language dependent. + // The language to retrieve the transition route group for. The following + // fields are language dependent: + // + // * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + // * + // `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -188,9 +194,11 @@ message CreateTransitionRouteGroupRequest { // Required. The transition route group to create. TransitionRouteGroup transition_route_group = 2 [(google.api.field_behavior) = REQUIRED]; - // The language to list transition route groups for. The field - // [`messages`][TransitionRoute.trigger_fulfillment.messages] in - // [TransitionRoute][google.cloud.dialogflow.cx.v3beta1.TransitionRoute] is language dependent. + // The language of the following fields in `TransitionRouteGroup`: + // + // * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + // * + // `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many @@ -208,9 +216,11 @@ message UpdateTransitionRouteGroupRequest { // The mask to control which fields get updated. google.protobuf.FieldMask update_mask = 2; - // The language to list transition route groups for. The field - // [`messages`][TransitionRoute.trigger_fulfillment.messages] in - // [TransitionRoute][google.cloud.dialogflow.cx.v3beta1.TransitionRoute] is language dependent. + // The language of the following fields in `TransitionRouteGroup`: + // + // * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + // * + // `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` // // If not specified, the agent's default language is used. // [Many diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/version.proto b/protos/google/cloud/dialogflow/cx/v3beta1/version.proto index 9648a427..8f90ed2b 100644 --- a/protos/google/cloud/dialogflow/cx/v3beta1/version.proto +++ b/protos/google/cloud/dialogflow/cx/v3beta1/version.proto @@ -87,7 +87,7 @@ service Versions { option (google.api.method_signature) = "name"; } - // Loads a specified version to draft version. + // Loads resources in the specified version to the draft flow. rpc LoadVersion(LoadVersionRequest) returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}:load" @@ -243,7 +243,7 @@ message DeleteVersionRequest { // The request message for [Versions.LoadVersion][google.cloud.dialogflow.cx.v3beta1.Versions.LoadVersion]. message LoadVersionRequest { - // Required. The [Version][google.cloud.dialogflow.cx.v3beta1.Version] to be loaded to draft version. + // Required. The [Version][google.cloud.dialogflow.cx.v3beta1.Version] to be loaded to draft flow. // Format: `projects//locations//agents//flows//versions/`. string name = 1 [ @@ -253,9 +253,9 @@ message LoadVersionRequest { } ]; - // This field is used to prevent accidental overwrite of other agent resources - // in the draft version, which can potentially impact other flow's behavior. - // If `allow_override_agent_resources` is false, conflicted agent-level - // resources will not be overridden (i.e. intents, entities, webhooks). + // This field is used to prevent accidental overwrite of other agent + // resources, which can potentially impact other flow's behavior. If + // `allow_override_agent_resources` is false, conflicted agent-level resources + // will not be overridden (i.e. intents, entities, webhooks). bool allow_override_agent_resources = 2; } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 00635b4d..34ebba91 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -25011,6 +25011,9 @@ export namespace google { /** Agent defaultLanguageCode */ defaultLanguageCode?: (string|null); + /** Agent supportedLanguageCodes */ + supportedLanguageCodes?: (string[]|null); + /** Agent timeZone */ timeZone?: (string|null); @@ -25054,6 +25057,9 @@ export namespace google { /** Agent defaultLanguageCode. */ public defaultLanguageCode: string; + /** Agent supportedLanguageCodes. */ + public supportedLanguageCodes: string[]; + /** Agent timeZone. */ public timeZone: string; @@ -25727,6 +25733,9 @@ export namespace google { /** ExportAgentRequest agentUri */ agentUri?: (string|null); + + /** ExportAgentRequest environment */ + environment?: (string|null); } /** Represents an ExportAgentRequest. */ @@ -25744,6 +25753,9 @@ export namespace google { /** ExportAgentRequest agentUri. */ public agentUri: string; + /** ExportAgentRequest environment. */ + public environment: string; + /** * Creates a new ExportAgentRequest instance using the specified properties. * @param [properties] Properties to set @@ -26454,6 +26466,34 @@ export namespace google { * @returns Promise */ public getFlowValidationResult(request: google.cloud.dialogflow.cx.v3beta1.IGetFlowValidationResultRequest): Promise; + + /** + * Calls ImportFlow. + * @param request ImportFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importFlow(request: google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.ImportFlowCallback): void; + + /** + * Calls ImportFlow. + * @param request ImportFlowRequest message or plain object + * @returns Promise + */ + public importFlow(request: google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest): Promise; + + /** + * Calls ExportFlow. + * @param request ExportFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportFlow(request: google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.ExportFlowCallback): void; + + /** + * Calls ExportFlow. + * @param request ExportFlowRequest message or plain object + * @returns Promise + */ + public exportFlow(request: google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest): Promise; } namespace Flows { @@ -26513,6 +26553,20 @@ export namespace google { * @param [response] FlowValidationResult */ type GetFlowValidationResultCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.FlowValidationResult) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#importFlow}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportFlowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#exportFlow}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportFlowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } /** Properties of a NluSettings. */ @@ -27744,6 +27798,418 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an ImportFlowRequest. */ + interface IImportFlowRequest { + + /** ImportFlowRequest parent */ + parent?: (string|null); + + /** ImportFlowRequest flowUri */ + flowUri?: (string|null); + + /** ImportFlowRequest flowContent */ + flowContent?: (Uint8Array|string|null); + + /** ImportFlowRequest importOption */ + importOption?: (google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption|keyof typeof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption|null); + } + + /** Represents an ImportFlowRequest. */ + class ImportFlowRequest implements IImportFlowRequest { + + /** + * Constructs a new ImportFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest); + + /** ImportFlowRequest parent. */ + public parent: string; + + /** ImportFlowRequest flowUri. */ + public flowUri: string; + + /** ImportFlowRequest flowContent. */ + public flowContent: (Uint8Array|string); + + /** ImportFlowRequest importOption. */ + public importOption: (google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption|keyof typeof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption); + + /** ImportFlowRequest flow. */ + public flow?: ("flowUri"|"flowContent"); + + /** + * Creates a new ImportFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest): google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest; + + /** + * Encodes the specified ImportFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.verify|verify} messages. + * @param message ImportFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.verify|verify} messages. + * @param message ImportFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest; + + /** + * Decodes an ImportFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest; + + /** + * Verifies an ImportFlowRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest; + + /** + * Creates a plain object from an ImportFlowRequest message. Also converts values to other types if specified. + * @param message ImportFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ImportFlowRequest { + + /** ImportOption enum. */ + enum ImportOption { + IMPORT_OPTION_UNSPECIFIED = 0, + KEEP = 1, + FALLBACK = 2 + } + } + + /** Properties of an ImportFlowResponse. */ + interface IImportFlowResponse { + + /** ImportFlowResponse flow */ + flow?: (string|null); + } + + /** Represents an ImportFlowResponse. */ + class ImportFlowResponse implements IImportFlowResponse { + + /** + * Constructs a new ImportFlowResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse); + + /** ImportFlowResponse flow. */ + public flow: string; + + /** + * Creates a new ImportFlowResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportFlowResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse): google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse; + + /** + * Encodes the specified ImportFlowResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse.verify|verify} messages. + * @param message ImportFlowResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportFlowResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse.verify|verify} messages. + * @param message ImportFlowResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportFlowResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse; + + /** + * Decodes an ImportFlowResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse; + + /** + * Verifies an ImportFlowResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportFlowResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportFlowResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse; + + /** + * Creates a plain object from an ImportFlowResponse message. Also converts values to other types if specified. + * @param message ImportFlowResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportFlowResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportFlowRequest. */ + interface IExportFlowRequest { + + /** ExportFlowRequest name */ + name?: (string|null); + + /** ExportFlowRequest flowUri */ + flowUri?: (string|null); + + /** ExportFlowRequest includeReferencedFlows */ + includeReferencedFlows?: (boolean|null); + } + + /** Represents an ExportFlowRequest. */ + class ExportFlowRequest implements IExportFlowRequest { + + /** + * Constructs a new ExportFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest); + + /** ExportFlowRequest name. */ + public name: string; + + /** ExportFlowRequest flowUri. */ + public flowUri: string; + + /** ExportFlowRequest includeReferencedFlows. */ + public includeReferencedFlows: boolean; + + /** + * Creates a new ExportFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest): google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest; + + /** + * Encodes the specified ExportFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest.verify|verify} messages. + * @param message ExportFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest.verify|verify} messages. + * @param message ExportFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest; + + /** + * Decodes an ExportFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest; + + /** + * Verifies an ExportFlowRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest; + + /** + * Creates a plain object from an ExportFlowRequest message. Also converts values to other types if specified. + * @param message ExportFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportFlowResponse. */ + interface IExportFlowResponse { + + /** ExportFlowResponse flowUri */ + flowUri?: (string|null); + + /** ExportFlowResponse flowContent */ + flowContent?: (Uint8Array|string|null); + } + + /** Represents an ExportFlowResponse. */ + class ExportFlowResponse implements IExportFlowResponse { + + /** + * Constructs a new ExportFlowResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse); + + /** ExportFlowResponse flowUri. */ + public flowUri: string; + + /** ExportFlowResponse flowContent. */ + public flowContent: (Uint8Array|string); + + /** ExportFlowResponse flow. */ + public flow?: ("flowUri"|"flowContent"); + + /** + * Creates a new ExportFlowResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportFlowResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse): google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse; + + /** + * Encodes the specified ExportFlowResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse.verify|verify} messages. + * @param message ExportFlowResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportFlowResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse.verify|verify} messages. + * @param message ExportFlowResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportFlowResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse; + + /** + * Decodes an ExportFlowResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse; + + /** + * Verifies an ExportFlowResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportFlowResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportFlowResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse; + + /** + * Creates a plain object from an ExportFlowResponse message. Also converts values to other types if specified. + * @param message ExportFlowResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportFlowResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents a Pages */ class Pages extends $protobuf.rpc.Service { diff --git a/protos/protos.js b/protos/protos.js index ec75d967..a703b237 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -58503,6 +58503,7 @@ * @property {string|null} [name] Agent name * @property {string|null} [displayName] Agent displayName * @property {string|null} [defaultLanguageCode] Agent defaultLanguageCode + * @property {Array.|null} [supportedLanguageCodes] Agent supportedLanguageCodes * @property {string|null} [timeZone] Agent timeZone * @property {string|null} [description] Agent description * @property {string|null} [avatarUri] Agent avatarUri @@ -58522,6 +58523,7 @@ * @param {google.cloud.dialogflow.cx.v3beta1.IAgent=} [properties] Properties to set */ function Agent(properties) { + this.supportedLanguageCodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58552,6 +58554,14 @@ */ Agent.prototype.defaultLanguageCode = ""; + /** + * Agent supportedLanguageCodes. + * @member {Array.} supportedLanguageCodes + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.supportedLanguageCodes = $util.emptyArray; + /** * Agent timeZone. * @member {string} timeZone @@ -58646,6 +58656,9 @@ writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); if (message.defaultLanguageCode != null && Object.hasOwnProperty.call(message, "defaultLanguageCode")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultLanguageCode); + if (message.supportedLanguageCodes != null && message.supportedLanguageCodes.length) + for (var i = 0; i < message.supportedLanguageCodes.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.supportedLanguageCodes[i]); if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.timeZone); if (message.description != null && Object.hasOwnProperty.call(message, "description")) @@ -58705,6 +58718,11 @@ case 3: message.defaultLanguageCode = reader.string(); break; + case 4: + if (!(message.supportedLanguageCodes && message.supportedLanguageCodes.length)) + message.supportedLanguageCodes = []; + message.supportedLanguageCodes.push(reader.string()); + break; case 5: message.timeZone = reader.string(); break; @@ -58773,6 +58791,13 @@ if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) if (!$util.isString(message.defaultLanguageCode)) return "defaultLanguageCode: string expected"; + if (message.supportedLanguageCodes != null && message.hasOwnProperty("supportedLanguageCodes")) { + if (!Array.isArray(message.supportedLanguageCodes)) + return "supportedLanguageCodes: array expected"; + for (var i = 0; i < message.supportedLanguageCodes.length; ++i) + if (!$util.isString(message.supportedLanguageCodes[i])) + return "supportedLanguageCodes: string[] expected"; + } if (message.timeZone != null && message.hasOwnProperty("timeZone")) if (!$util.isString(message.timeZone)) return "timeZone: string expected"; @@ -58820,6 +58845,13 @@ message.displayName = String(object.displayName); if (object.defaultLanguageCode != null) message.defaultLanguageCode = String(object.defaultLanguageCode); + if (object.supportedLanguageCodes) { + if (!Array.isArray(object.supportedLanguageCodes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Agent.supportedLanguageCodes: array expected"); + message.supportedLanguageCodes = []; + for (var i = 0; i < object.supportedLanguageCodes.length; ++i) + message.supportedLanguageCodes[i] = String(object.supportedLanguageCodes[i]); + } if (object.timeZone != null) message.timeZone = String(object.timeZone); if (object.description != null) @@ -58855,6 +58887,8 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.supportedLanguageCodes = []; if (options.defaults) { object.name = ""; object.displayName = ""; @@ -58874,6 +58908,11 @@ object.displayName = message.displayName; if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) object.defaultLanguageCode = message.defaultLanguageCode; + if (message.supportedLanguageCodes && message.supportedLanguageCodes.length) { + object.supportedLanguageCodes = []; + for (var j = 0; j < message.supportedLanguageCodes.length; ++j) + object.supportedLanguageCodes[j] = message.supportedLanguageCodes[j]; + } if (message.timeZone != null && message.hasOwnProperty("timeZone")) object.timeZone = message.timeZone; if (message.description != null && message.hasOwnProperty("description")) @@ -60187,6 +60226,7 @@ * @interface IExportAgentRequest * @property {string|null} [name] ExportAgentRequest name * @property {string|null} [agentUri] ExportAgentRequest agentUri + * @property {string|null} [environment] ExportAgentRequest environment */ /** @@ -60220,6 +60260,14 @@ */ ExportAgentRequest.prototype.agentUri = ""; + /** + * ExportAgentRequest environment. + * @member {string} environment + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.environment = ""; + /** * Creates a new ExportAgentRequest instance using the specified properties. * @function create @@ -60248,6 +60296,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.environment); return writer; }; @@ -60288,6 +60338,9 @@ case 2: message.agentUri = reader.string(); break; + case 5: + message.environment = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -60329,6 +60382,9 @@ if (message.agentUri != null && message.hasOwnProperty("agentUri")) if (!$util.isString(message.agentUri)) return "agentUri: string expected"; + if (message.environment != null && message.hasOwnProperty("environment")) + if (!$util.isString(message.environment)) + return "environment: string expected"; return null; }; @@ -60348,6 +60404,8 @@ message.name = String(object.name); if (object.agentUri != null) message.agentUri = String(object.agentUri); + if (object.environment != null) + message.environment = String(object.environment); return message; }; @@ -60367,11 +60425,14 @@ if (options.defaults) { object.name = ""; object.agentUri = ""; + object.environment = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.agentUri != null && message.hasOwnProperty("agentUri")) object.agentUri = message.agentUri; + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = message.environment; return object; }; @@ -61888,6 +61949,72 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#importFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef ImportFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportFlow. + * @function importFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest} request ImportFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.ImportFlowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.importFlow = function importFlow(request, callback) { + return this.rpcCall(importFlow, $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportFlow" }); + + /** + * Calls ImportFlow. + * @function importFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest} request ImportFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#exportFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef ExportFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportFlow. + * @function exportFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest} request ExportFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.ExportFlowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.exportFlow = function exportFlow(request, callback) { + return this.rpcCall(exportFlow, $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportFlow" }); + + /** + * Calls ExportFlow. + * @function exportFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest} request ExportFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Flows; })(); @@ -64826,6 +64953,977 @@ return FlowValidationResult; })(); + v3beta1.ImportFlowRequest = (function() { + + /** + * Properties of an ImportFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IImportFlowRequest + * @property {string|null} [parent] ImportFlowRequest parent + * @property {string|null} [flowUri] ImportFlowRequest flowUri + * @property {Uint8Array|null} [flowContent] ImportFlowRequest flowContent + * @property {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption|null} [importOption] ImportFlowRequest importOption + */ + + /** + * Constructs a new ImportFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an ImportFlowRequest. + * @implements IImportFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest=} [properties] Properties to set + */ + function ImportFlowRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportFlowRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @instance + */ + ImportFlowRequest.prototype.parent = ""; + + /** + * ImportFlowRequest flowUri. + * @member {string} flowUri + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @instance + */ + ImportFlowRequest.prototype.flowUri = ""; + + /** + * ImportFlowRequest flowContent. + * @member {Uint8Array} flowContent + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @instance + */ + ImportFlowRequest.prototype.flowContent = $util.newBuffer([]); + + /** + * ImportFlowRequest importOption. + * @member {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption} importOption + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @instance + */ + ImportFlowRequest.prototype.importOption = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportFlowRequest flow. + * @member {"flowUri"|"flowContent"|undefined} flow + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @instance + */ + Object.defineProperty(ImportFlowRequest.prototype, "flow", { + get: $util.oneOfGetter($oneOfFields = ["flowUri", "flowContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest} ImportFlowRequest instance + */ + ImportFlowRequest.create = function create(properties) { + return new ImportFlowRequest(properties); + }; + + /** + * Encodes the specified ImportFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest} message ImportFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportFlowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.flowUri != null && Object.hasOwnProperty.call(message, "flowUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.flowUri); + if (message.flowContent != null && Object.hasOwnProperty.call(message, "flowContent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.flowContent); + if (message.importOption != null && Object.hasOwnProperty.call(message, "importOption")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.importOption); + return writer; + }; + + /** + * Encodes the specified ImportFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest} message ImportFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest} ImportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportFlowRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.flowUri = reader.string(); + break; + case 3: + message.flowContent = reader.bytes(); + break; + case 4: + message.importOption = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest} ImportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportFlowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.flowUri != null && message.hasOwnProperty("flowUri")) { + properties.flow = 1; + if (!$util.isString(message.flowUri)) + return "flowUri: string expected"; + } + if (message.flowContent != null && message.hasOwnProperty("flowContent")) { + if (properties.flow === 1) + return "flow: multiple values"; + properties.flow = 1; + if (!(message.flowContent && typeof message.flowContent.length === "number" || $util.isString(message.flowContent))) + return "flowContent: buffer expected"; + } + if (message.importOption != null && message.hasOwnProperty("importOption")) + switch (message.importOption) { + default: + return "importOption: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an ImportFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest} ImportFlowRequest + */ + ImportFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.flowUri != null) + message.flowUri = String(object.flowUri); + if (object.flowContent != null) + if (typeof object.flowContent === "string") + $util.base64.decode(object.flowContent, message.flowContent = $util.newBuffer($util.base64.length(object.flowContent)), 0); + else if (object.flowContent.length) + message.flowContent = object.flowContent; + switch (object.importOption) { + case "IMPORT_OPTION_UNSPECIFIED": + case 0: + message.importOption = 0; + break; + case "KEEP": + case 1: + message.importOption = 1; + break; + case "FALLBACK": + case 2: + message.importOption = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an ImportFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest} message ImportFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.importOption = options.enums === String ? "IMPORT_OPTION_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.flowUri != null && message.hasOwnProperty("flowUri")) { + object.flowUri = message.flowUri; + if (options.oneofs) + object.flow = "flowUri"; + } + if (message.flowContent != null && message.hasOwnProperty("flowContent")) { + object.flowContent = options.bytes === String ? $util.base64.encode(message.flowContent, 0, message.flowContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.flowContent) : message.flowContent; + if (options.oneofs) + object.flow = "flowContent"; + } + if (message.importOption != null && message.hasOwnProperty("importOption")) + object.importOption = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption[message.importOption] : message.importOption; + return object; + }; + + /** + * Converts this ImportFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest + * @instance + * @returns {Object.} JSON object + */ + ImportFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ImportOption enum. + * @name google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption + * @enum {number} + * @property {number} IMPORT_OPTION_UNSPECIFIED=0 IMPORT_OPTION_UNSPECIFIED value + * @property {number} KEEP=1 KEEP value + * @property {number} FALLBACK=2 FALLBACK value + */ + ImportFlowRequest.ImportOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IMPORT_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "KEEP"] = 1; + values[valuesById[2] = "FALLBACK"] = 2; + return values; + })(); + + return ImportFlowRequest; + })(); + + v3beta1.ImportFlowResponse = (function() { + + /** + * Properties of an ImportFlowResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IImportFlowResponse + * @property {string|null} [flow] ImportFlowResponse flow + */ + + /** + * Constructs a new ImportFlowResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an ImportFlowResponse. + * @implements IImportFlowResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse=} [properties] Properties to set + */ + function ImportFlowResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportFlowResponse flow. + * @member {string} flow + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @instance + */ + ImportFlowResponse.prototype.flow = ""; + + /** + * Creates a new ImportFlowResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse} ImportFlowResponse instance + */ + ImportFlowResponse.create = function create(properties) { + return new ImportFlowResponse(properties); + }; + + /** + * Encodes the specified ImportFlowResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse} message ImportFlowResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportFlowResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.flow != null && Object.hasOwnProperty.call(message, "flow")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.flow); + return writer; + }; + + /** + * Encodes the specified ImportFlowResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse} message ImportFlowResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportFlowResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportFlowResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse} ImportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportFlowResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.flow = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportFlowResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse} ImportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportFlowResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportFlowResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportFlowResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.flow != null && message.hasOwnProperty("flow")) + if (!$util.isString(message.flow)) + return "flow: string expected"; + return null; + }; + + /** + * Creates an ImportFlowResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse} ImportFlowResponse + */ + ImportFlowResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse(); + if (object.flow != null) + message.flow = String(object.flow); + return message; + }; + + /** + * Creates a plain object from an ImportFlowResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse} message ImportFlowResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportFlowResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.flow = ""; + if (message.flow != null && message.hasOwnProperty("flow")) + object.flow = message.flow; + return object; + }; + + /** + * Converts this ImportFlowResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse + * @instance + * @returns {Object.} JSON object + */ + ImportFlowResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImportFlowResponse; + })(); + + v3beta1.ExportFlowRequest = (function() { + + /** + * Properties of an ExportFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IExportFlowRequest + * @property {string|null} [name] ExportFlowRequest name + * @property {string|null} [flowUri] ExportFlowRequest flowUri + * @property {boolean|null} [includeReferencedFlows] ExportFlowRequest includeReferencedFlows + */ + + /** + * Constructs a new ExportFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an ExportFlowRequest. + * @implements IExportFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest=} [properties] Properties to set + */ + function ExportFlowRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportFlowRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @instance + */ + ExportFlowRequest.prototype.name = ""; + + /** + * ExportFlowRequest flowUri. + * @member {string} flowUri + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @instance + */ + ExportFlowRequest.prototype.flowUri = ""; + + /** + * ExportFlowRequest includeReferencedFlows. + * @member {boolean} includeReferencedFlows + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @instance + */ + ExportFlowRequest.prototype.includeReferencedFlows = false; + + /** + * Creates a new ExportFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest} ExportFlowRequest instance + */ + ExportFlowRequest.create = function create(properties) { + return new ExportFlowRequest(properties); + }; + + /** + * Encodes the specified ExportFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest} message ExportFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportFlowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.flowUri != null && Object.hasOwnProperty.call(message, "flowUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.flowUri); + if (message.includeReferencedFlows != null && Object.hasOwnProperty.call(message, "includeReferencedFlows")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.includeReferencedFlows); + return writer; + }; + + /** + * Encodes the specified ExportFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest} message ExportFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest} ExportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportFlowRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.flowUri = reader.string(); + break; + case 4: + message.includeReferencedFlows = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest} ExportFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportFlowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.flowUri != null && message.hasOwnProperty("flowUri")) + if (!$util.isString(message.flowUri)) + return "flowUri: string expected"; + if (message.includeReferencedFlows != null && message.hasOwnProperty("includeReferencedFlows")) + if (typeof message.includeReferencedFlows !== "boolean") + return "includeReferencedFlows: boolean expected"; + return null; + }; + + /** + * Creates an ExportFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest} ExportFlowRequest + */ + ExportFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.flowUri != null) + message.flowUri = String(object.flowUri); + if (object.includeReferencedFlows != null) + message.includeReferencedFlows = Boolean(object.includeReferencedFlows); + return message; + }; + + /** + * Creates a plain object from an ExportFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest} message ExportFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.flowUri = ""; + object.includeReferencedFlows = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.flowUri != null && message.hasOwnProperty("flowUri")) + object.flowUri = message.flowUri; + if (message.includeReferencedFlows != null && message.hasOwnProperty("includeReferencedFlows")) + object.includeReferencedFlows = message.includeReferencedFlows; + return object; + }; + + /** + * Converts this ExportFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest + * @instance + * @returns {Object.} JSON object + */ + ExportFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportFlowRequest; + })(); + + v3beta1.ExportFlowResponse = (function() { + + /** + * Properties of an ExportFlowResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IExportFlowResponse + * @property {string|null} [flowUri] ExportFlowResponse flowUri + * @property {Uint8Array|null} [flowContent] ExportFlowResponse flowContent + */ + + /** + * Constructs a new ExportFlowResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an ExportFlowResponse. + * @implements IExportFlowResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse=} [properties] Properties to set + */ + function ExportFlowResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportFlowResponse flowUri. + * @member {string} flowUri + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @instance + */ + ExportFlowResponse.prototype.flowUri = ""; + + /** + * ExportFlowResponse flowContent. + * @member {Uint8Array} flowContent + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @instance + */ + ExportFlowResponse.prototype.flowContent = $util.newBuffer([]); + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportFlowResponse flow. + * @member {"flowUri"|"flowContent"|undefined} flow + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @instance + */ + Object.defineProperty(ExportFlowResponse.prototype, "flow", { + get: $util.oneOfGetter($oneOfFields = ["flowUri", "flowContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportFlowResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse} ExportFlowResponse instance + */ + ExportFlowResponse.create = function create(properties) { + return new ExportFlowResponse(properties); + }; + + /** + * Encodes the specified ExportFlowResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse} message ExportFlowResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportFlowResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.flowUri != null && Object.hasOwnProperty.call(message, "flowUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.flowUri); + if (message.flowContent != null && Object.hasOwnProperty.call(message, "flowContent")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.flowContent); + return writer; + }; + + /** + * Encodes the specified ExportFlowResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse} message ExportFlowResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportFlowResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportFlowResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse} ExportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportFlowResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.flowUri = reader.string(); + break; + case 2: + message.flowContent = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportFlowResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse} ExportFlowResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportFlowResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportFlowResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportFlowResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.flowUri != null && message.hasOwnProperty("flowUri")) { + properties.flow = 1; + if (!$util.isString(message.flowUri)) + return "flowUri: string expected"; + } + if (message.flowContent != null && message.hasOwnProperty("flowContent")) { + if (properties.flow === 1) + return "flow: multiple values"; + properties.flow = 1; + if (!(message.flowContent && typeof message.flowContent.length === "number" || $util.isString(message.flowContent))) + return "flowContent: buffer expected"; + } + return null; + }; + + /** + * Creates an ExportFlowResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse} ExportFlowResponse + */ + ExportFlowResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse(); + if (object.flowUri != null) + message.flowUri = String(object.flowUri); + if (object.flowContent != null) + if (typeof object.flowContent === "string") + $util.base64.decode(object.flowContent, message.flowContent = $util.newBuffer($util.base64.length(object.flowContent)), 0); + else if (object.flowContent.length) + message.flowContent = object.flowContent; + return message; + }; + + /** + * Creates a plain object from an ExportFlowResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse} message ExportFlowResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportFlowResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.flowUri != null && message.hasOwnProperty("flowUri")) { + object.flowUri = message.flowUri; + if (options.oneofs) + object.flow = "flowUri"; + } + if (message.flowContent != null && message.hasOwnProperty("flowContent")) { + object.flowContent = options.bytes === String ? $util.base64.encode(message.flowContent, 0, message.flowContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.flowContent) : message.flowContent; + if (options.oneofs) + object.flow = "flowContent"; + } + return object; + }; + + /** + * Converts this ExportFlowResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse + * @instance + * @returns {Object.} JSON object + */ + ExportFlowResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportFlowResponse; + })(); + v3beta1.Pages = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 5fc135f7..11692f33 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -6927,6 +6927,11 @@ "(google.api.field_behavior)": "IMMUTABLE" } }, + "supportedLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 4 + }, "timeZone": { "type": "string", "id": 5, @@ -7078,6 +7083,14 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "environment": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } } } }, @@ -7352,6 +7365,54 @@ "(google.api.method_signature)": "name" } ] + }, + "ImportFlow": { + "requestType": "ImportFlowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows:import", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "ImportFlowResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows:import", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ImportFlowResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "ExportFlow": { + "requestType": "ExportFlowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}:export", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "ExportFlowResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}:export", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ExportFlowResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] } } }, @@ -7611,6 +7672,104 @@ } } }, + "ImportFlowRequest": { + "oneofs": { + "flow": { + "oneof": [ + "flowUri", + "flowContent" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Flow" + } + }, + "flowUri": { + "type": "string", + "id": 2 + }, + "flowContent": { + "type": "bytes", + "id": 3 + }, + "importOption": { + "type": "ImportOption", + "id": 4 + } + }, + "nested": { + "ImportOption": { + "values": { + "IMPORT_OPTION_UNSPECIFIED": 0, + "KEEP": 1, + "FALLBACK": 2 + } + } + } + }, + "ImportFlowResponse": { + "fields": { + "flow": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + } + } + }, + "ExportFlowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + }, + "flowUri": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "includeReferencedFlows": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExportFlowResponse": { + "oneofs": { + "flow": { + "oneof": [ + "flowUri", + "flowContent" + ] + } + }, + "fields": { + "flowUri": { + "type": "string", + "id": 1 + }, + "flowContent": { + "type": "bytes", + "id": 2 + } + } + }, "Pages": { "options": { "(google.api.default_host)": "dialogflow.googleapis.com", diff --git a/src/v3beta1/agents_client.ts b/src/v3beta1/agents_client.ts index 2d9d01e7..ccec2e5a 100644 --- a/src/v3beta1/agents_client.ts +++ b/src/v3beta1/agents_client.ts @@ -1058,6 +1058,10 @@ export class AgentsClient { * export the agent to. The format of this URI must be * `gs:///`. * If left unspecified, the serialized agent is returned inline. + * @param {string} [request.environment] + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//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. diff --git a/src/v3beta1/flows_client.ts b/src/v3beta1/flows_client.ts index 277763ef..a8858c49 100644 --- a/src/v3beta1/flows_client.ts +++ b/src/v3beta1/flows_client.ts @@ -260,6 +260,18 @@ export class FlowsClient { const trainFlowMetadata = protoFilesRoot.lookup( '.google.protobuf.Struct' ) as gax.protobuf.Type; + const importFlowResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse' + ) as gax.protobuf.Type; + const importFlowMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const exportFlowResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse' + ) as gax.protobuf.Type; + const exportFlowMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; this.descriptors.longrunning = { trainFlow: new this._gaxModule.LongrunningDescriptor( @@ -267,6 +279,16 @@ export class FlowsClient { trainFlowResponse.decode.bind(trainFlowResponse), trainFlowMetadata.decode.bind(trainFlowMetadata) ), + importFlow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importFlowResponse.decode.bind(importFlowResponse), + importFlowMetadata.decode.bind(importFlowMetadata) + ), + exportFlow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportFlowResponse.decode.bind(exportFlowResponse), + exportFlowMetadata.decode.bind(exportFlowMetadata) + ), }; // Put together the default options sent with requests. @@ -323,6 +345,8 @@ export class FlowsClient { 'trainFlow', 'validateFlow', 'getFlowValidationResult', + 'importFlow', + 'exportFlow', ]; for (const methodName of flowsStubMethods) { const callPromise = this.flowsStub.then( @@ -455,7 +479,9 @@ export class FlowsClient { * The language of the following fields in `flow`: * * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -666,7 +692,9 @@ export class FlowsClient { * dependent: * * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -772,7 +800,9 @@ export class FlowsClient { * The language of the following fields in `flow`: * * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -1187,6 +1217,311 @@ export class FlowsClient { protos.google.protobuf.Struct >; } + importFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Imports the specified flow to the specified agent from a binary file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to import the flow into. + * Format: `projects//locations//agents/`. + * @param {string} request.flowUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import flow from. The format of this URI must be + * `gs:///`. + * @param {Buffer} request.flowContent + * Uncompressed raw byte content for flow. + * @param {google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest.ImportOption} request.importOption + * Flow import mode. If not specified, `KEEP` is assumed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.importFlow(request); + * const [response] = await operation.promise(); + */ + importFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.importFlow(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importFlow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkImportFlowProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkImportFlowProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse, + protos.google.protobuf.Struct + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.importFlow, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.ImportFlowResponse, + protos.google.protobuf.Struct + >; + } + exportFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + exportFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Exports the specified flow to a binary file. + * + * Note that resources (e.g. intents, entities, webhooks) that the flow + * references will also be exported. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the flow to export. + * Format: `projects//locations//agents//flows/`. + * @param {string} [request.flowUri] + * Optional. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + * export the flow to. The format of this URI must be + * `gs:///`. + * If left unspecified, the serialized flow is returned inline. + * @param {boolean} [request.includeReferencedFlows] + * Optional. Whether to export flows referenced by the specified flow. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.exportFlow(request); + * const [response] = await operation.promise(); + */ + exportFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.exportFlow(request, options, callback); + } + /** + * Check the status of the long running operation returned by `exportFlow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkExportFlowProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkExportFlowProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse, + protos.google.protobuf.Struct + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.exportFlow, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.ExportFlowResponse, + protos.google.protobuf.Struct + >; + } listFlows( request: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, options?: CallOptions @@ -1236,7 +1571,9 @@ export class FlowsClient { * dependent: * * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -1318,7 +1655,9 @@ export class FlowsClient { * dependent: * * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -1378,7 +1717,9 @@ export class FlowsClient { * dependent: * * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many diff --git a/src/v3beta1/flows_client_config.json b/src/v3beta1/flows_client_config.json index a27eab59..b50d70cc 100644 --- a/src/v3beta1/flows_client_config.json +++ b/src/v3beta1/flows_client_config.json @@ -62,6 +62,16 @@ "timeout_millis": 60000, "retry_codes_name": "unavailable", "retry_params_name": "default" + }, + "ImportFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" } } } diff --git a/src/v3beta1/gapic_metadata.json b/src/v3beta1/gapic_metadata.json index 9ccaa350..6a1eae01 100644 --- a/src/v3beta1/gapic_metadata.json +++ b/src/v3beta1/gapic_metadata.json @@ -391,6 +391,16 @@ "trainFlow" ] }, + "ImportFlow": { + "methods": [ + "importFlow" + ] + }, + "ExportFlow": { + "methods": [ + "exportFlow" + ] + }, "ListFlows": { "methods": [ "listFlows", @@ -438,6 +448,16 @@ "trainFlow" ] }, + "ImportFlow": { + "methods": [ + "importFlow" + ] + }, + "ExportFlow": { + "methods": [ + "exportFlow" + ] + }, "ListFlows": { "methods": [ "listFlows", diff --git a/src/v3beta1/pages_client.ts b/src/v3beta1/pages_client.ts index 7e41ad01..43a4f626 100644 --- a/src/v3beta1/pages_client.ts +++ b/src/v3beta1/pages_client.ts @@ -416,11 +416,17 @@ export class PagesClient { * dependent: * * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - * * `Page.transition_routes.trigger_fulfillment.messages` * * - * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -527,11 +533,17 @@ export class PagesClient { * The language of the following fields in `page`: * * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - * * `Page.transition_routes.trigger_fulfillment.messages` * * - * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -634,11 +646,17 @@ export class PagesClient { * The language of the following fields in `page`: * * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - * * `Page.transition_routes.trigger_fulfillment.messages` * * - * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -853,11 +871,17 @@ export class PagesClient { * dependent: * * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - * * `Page.transition_routes.trigger_fulfillment.messages` * * - * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -940,11 +964,17 @@ export class PagesClient { * dependent: * * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - * * `Page.transition_routes.trigger_fulfillment.messages` * * - * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -1005,11 +1035,17 @@ export class PagesClient { * dependent: * * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` - * * `Page.transition_routes.trigger_fulfillment.messages` * * - * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many diff --git a/src/v3beta1/sessions_client.ts b/src/v3beta1/sessions_client.ts index 4fef0640..9e0c0e26 100644 --- a/src/v3beta1/sessions_client.ts +++ b/src/v3beta1/sessions_client.ts @@ -33,8 +33,9 @@ const version = require('../../../package.json').version; /** * A session represents an interaction with a user. You retrieve user input - * and pass it to the {@link google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent|DetectIntent} method to determine - * user intent and respond. + * and pass it to the + * {@link google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent|DetectIntent} + * method to determine user intent and respond. * @class * @memberof v3beta1 */ @@ -629,9 +630,13 @@ export class SessionsClient { > ): void; /** - * Fulfills a matched intent returned by {@link google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent|MatchIntent}. - * Must be called after {@link google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent|MatchIntent}, with input from - * {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse|MatchIntentResponse}. Otherwise, the behavior is undefined. + * Fulfills a matched intent returned by + * {@link google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent|MatchIntent}. + * Must be called after + * {@link google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent|MatchIntent}, + * with input from + * {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse|MatchIntentResponse}. + * Otherwise, the behavior is undefined. * * @param {Object} request * The request object that will be sent. diff --git a/src/v3beta1/transition_route_groups_client.ts b/src/v3beta1/transition_route_groups_client.ts index 5345cff3..89456f8a 100644 --- a/src/v3beta1/transition_route_groups_client.ts +++ b/src/v3beta1/transition_route_groups_client.ts @@ -417,9 +417,12 @@ export class TransitionRouteGroupsClient { * Format: `projects//locations//agents//flows//transitionRouteGroups/`. * @param {string} request.languageCode - * The language to list transition route groups for. The field - * {@link TransitionRoute.trigger_fulfillment.messages|`messages`} in - * {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute|TransitionRoute} is language dependent. + * The language to retrieve the transition route group for. The following + * fields are language dependent: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -533,9 +536,11 @@ export class TransitionRouteGroupsClient { * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} request.transitionRouteGroup * Required. The transition route group to create. * @param {string} request.languageCode - * The language to list transition route groups for. The field - * {@link TransitionRoute.trigger_fulfillment.messages|`messages`} in - * {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute|TransitionRoute} is language dependent. + * The language of the following fields in `TransitionRouteGroup`: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -647,9 +652,11 @@ export class TransitionRouteGroupsClient { * @param {google.protobuf.FieldMask} request.updateMask * The mask to control which fields get updated. * @param {string} request.languageCode - * The language to list transition route groups for. The field - * {@link TransitionRoute.trigger_fulfillment.messages|`messages`} in - * {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute|TransitionRoute} is language dependent. + * The language of the following fields in `TransitionRouteGroup`: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -876,9 +883,12 @@ export class TransitionRouteGroupsClient { * @param {string} request.pageToken * The next_page_token value returned from a previous list request. * @param {string} request.languageCode - * The language to list transition route groups for. The field - * {@link TransitionRoute.trigger_fulfillment.messages|`messages`} in - * {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute|TransitionRoute} is language dependent. + * The language to list transition route groups for. The following fields are + * language dependent: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -961,9 +971,12 @@ export class TransitionRouteGroupsClient { * @param {string} request.pageToken * The next_page_token value returned from a previous list request. * @param {string} request.languageCode - * The language to list transition route groups for. The field - * {@link TransitionRoute.trigger_fulfillment.messages|`messages`} in - * {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute|TransitionRoute} is language dependent. + * The language to list transition route groups for. The following fields are + * language dependent: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many @@ -1020,9 +1033,12 @@ export class TransitionRouteGroupsClient { * @param {string} request.pageToken * The next_page_token value returned from a previous list request. * @param {string} request.languageCode - * The language to list transition route groups for. The field - * {@link TransitionRoute.trigger_fulfillment.messages|`messages`} in - * {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute|TransitionRoute} is language dependent. + * The language to list transition route groups for. The following fields are + * language dependent: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` * * If not specified, the agent's default language is used. * [Many diff --git a/src/v3beta1/versions_client.ts b/src/v3beta1/versions_client.ts index 76668e9b..446889ea 100644 --- a/src/v3beta1/versions_client.ts +++ b/src/v3beta1/versions_client.ts @@ -898,19 +898,19 @@ export class VersionsClient { > ): void; /** - * Loads a specified version to draft version. + * Loads resources in the specified version to the draft flow. * * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Version|Version} to be loaded to draft version. + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Version|Version} to be loaded to draft flow. * Format: `projects//locations//agents//flows//versions/`. * @param {boolean} request.allowOverrideAgentResources - * This field is used to prevent accidental overwrite of other agent resources - * in the draft version, which can potentially impact other flow's behavior. - * If `allow_override_agent_resources` is false, conflicted agent-level - * resources will not be overridden (i.e. intents, entities, webhooks). + * This field is used to prevent accidental overwrite of other agent + * resources, which can potentially impact other flow's behavior. If + * `allow_override_agent_resources` is false, conflicted agent-level resources + * will not be overridden (i.e. intents, entities, webhooks). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. diff --git a/test/gapic_flows_v3beta1.ts b/test/gapic_flows_v3beta1.ts index d6ab33f9..032b6654 100644 --- a/test/gapic_flows_v3beta1.ts +++ b/test/gapic_flows_v3beta1.ts @@ -1094,6 +1094,388 @@ describe('v3beta1.FlowsClient', () => { }); }); + describe('importFlow', () => { + it('invokes importFlow without error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importFlow = stubLongRunningCall(expectedResponse); + const [operation] = await client.importFlow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importFlow without error using callback', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importFlow = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.importFlow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IImportFlowResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.importFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes importFlow with call error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importFlow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importFlow(request), expectedError); + assert( + (client.innerApiCalls.importFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes importFlow with LRO error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ImportFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.importFlow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importFlow(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.importFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkImportFlowProgress without error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + 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.checkImportFlowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportFlowProgress with error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + 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.checkImportFlowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('exportFlow', () => { + it('invokes exportFlow without error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportFlow = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportFlow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.exportFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes exportFlow without error using callback', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportFlow = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.exportFlow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportFlowResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.exportFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes exportFlow with call error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportFlow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.exportFlow(request), expectedError); + assert( + (client.innerApiCalls.exportFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes exportFlow with LRO error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportFlow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportFlow(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.exportFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkExportFlowProgress without error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + 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.checkExportFlowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportFlowProgress with error', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + 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.checkExportFlowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listFlows', () => { it('invokes listFlows without error', async () => { const client = new flowsModule.v3beta1.FlowsClient({