diff --git a/package.json b/package.json index d08e849c..38464b0d 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "prelint": "cd samples; npm link ../; npm i", "prepare": "npm run compile-protos && npm run compile", "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test", + "test": "c8 npm run test:all", + "test:all": "mocha 'build/test/*v3.js' && mocha 'build/test/*v3beta1.js'", "samples-test": "cd samples/ && npm link ../ && npm test" }, "dependencies": { diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto b/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto new file mode 100644 index 00000000..473475d6 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/agent.proto @@ -0,0 +1,318 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/flow.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "AgentProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Agents][google.cloud.dialogflow.cx.v3beta1.Agent]. +service Agents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all agents in the specified location. + rpc ListAgents(ListAgentsRequest) returns (ListAgentsResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*}/agents" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent. + rpc GetAgent(GetAgentRequest) returns (Agent) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an agent in the specified location. + rpc CreateAgent(CreateAgentRequest) returns (Agent) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*}/agents" + body: "agent" + }; + option (google.api.method_signature) = "parent,agent"; + } + + // Updates the specified agent. + rpc UpdateAgent(UpdateAgentRequest) returns (Agent) { + option (google.api.http) = { + patch: "/v3beta1/{agent.name=projects/*/locations/*/agents/*}" + body: "agent" + }; + option (google.api.method_signature) = "agent,update_mask"; + } + + // Deletes the specified agent. + rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Exports the specified agent to a binary file. + rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{name=projects/*/locations/*/agents/*}:export" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "ExportAgentResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Restores the specified agent from a binary file. + // + // Replaces the current agent with a new one. Note that all existing resources + // in agent (e.g. intents, entity types, flows) will be removed. + rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{name=projects/*/locations/*/agents/*}:restore" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Settings related to speech recognition. +message SpeechToTextSettings { + // Whether to use speech adaptation for speech recognition. + bool enable_speech_adaptation = 1; +} + +// Agents are best described as Natural Language Understanding (NLU) modules +// that transform user requests into actionable data. You can include agents +// in your app, product, or service to determine user intent and respond to the +// user in a natural way. +// +// After you create an agent, you can add [Intents][google.cloud.dialogflow.cx.v3beta1.Intent], +// [Entity Types][google.cloud.dialogflow.cx.v3beta1.EntityType], [Flows][google.cloud.dialogflow.cx.v3beta1.Flow], [Fulfillments][google.cloud.dialogflow.cx.v3beta1.Fulfillment], +// [Webhooks][google.cloud.dialogflow.cx.v3beta1.Webhook], and so on to manage the conversation flows.. +message Agent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Agent" + pattern: "projects/{project}/locations/{location}/agents/{agent}" + }; + + // The unique identifier of the agent. + // Required for the [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent] method. [Agents.CreateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.CreateAgent] + // populates the name automatically. + // Format: `projects//locations//agents/`. + string name = 1; + + // Required. The human-readable name of the agent, unique within the location. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Immutable. The default language of the agent as a language tag. + // See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + // This field cannot be set by the [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent] method. + string default_language_code = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // 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. + string time_zone = 5 [(google.api.field_behavior) = REQUIRED]; + + // The description of the agent. The maximum length is 500 characters. If + // exceeded, the request is rejected. + string description = 6; + + // The URI of the agent's avatar. Avatars are used throughout the Dialogflow + // console and in the self-hosted [Web + // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + // integration. + string avatar_uri = 7; + + // Speech recognition related settings. + SpeechToTextSettings speech_to_text_settings = 13; + + // Immutable. Name of the start flow in this agent. A start flow will be automatically + // created when the agent is created, and can only be deleted by deleting the + // agent. + // Format: `projects//locations//agents//flows/`. + string start_flow = 16 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + } + ]; + + // Indicates if stackdriver logging is enabled for the agent. + bool enable_stackdriver_logging = 18; + + // Indicates if automatic spell correction is enabled in detect intent + // requests. + bool enable_spell_correction = 20; +} + +// The request message for [Agents.ListAgents][google.cloud.dialogflow.cx.v3beta1.Agents.ListAgents]. +message ListAgentsRequest { + // Required. The location to list all agents for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Agents.ListAgents][google.cloud.dialogflow.cx.v3beta1.Agents.ListAgents]. +message ListAgentsResponse { + // The list of agents. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Agent agents = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [Agents.GetAgent][google.cloud.dialogflow.cx.v3beta1.Agents.GetAgent]. +message GetAgentRequest { + // Required. The name of the agent. + // Format: `projects//locations//agents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.CreateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.CreateAgent]. +message CreateAgentRequest { + // Required. The location to create a agent for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to create. + Agent agent = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent]. +message UpdateAgentRequest { + // Required. The agent to update. + Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The mask to control which fields get updated. If the mask is not present, + // all fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.cx.v3beta1.Agents.DeleteAgent]. +message DeleteAgentRequest { + // Required. The name of the agent to delete. + // Format: `projects//locations//agents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.ExportAgent][google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgent]. +message ExportAgentRequest { + // Required. The name of the agent to export. + // Format: `projects//locations//agents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + // export the agent to. The format of this URI must be + // `gs:///`. + // If left unspecified, the serialized agent is returned inline. + string agent_uri = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Agents.ExportAgent][google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgent]. +message ExportAgentResponse { + // The exported agent. + oneof agent { + // The URI to a file containing the exported agent. This field is populated + // only if `agent_uri` is specified in [ExportAgentRequest][google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest]. + string agent_uri = 1; + + // Uncompressed raw byte content for agent. + bytes agent_content = 2; + } +} + +// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.cx.v3beta1.Agents.RestoreAgent]. +message RestoreAgentRequest { + // Required. The name of the agent to restore into. + // Format: `projects//locations//agents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to restore. + oneof agent { + // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + // to restore agent from. The format of this URI must be + // `gs:///`. + string agent_uri = 2; + + // Uncompressed raw byte content for agent. + bytes agent_content = 3; + } +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto b/protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto new file mode 100644 index 00000000..e28a50da --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto @@ -0,0 +1,305 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.cx.v3beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "AudioConfigProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Information for a word recognized by the speech recognizer. +message SpeechWordInfo { + // The word this info is for. + string word = 3; + + // Time offset relative to the beginning of the audio that corresponds to the + // start of the spoken word. This is an experimental feature and the accuracy + // of the time offset can vary. + google.protobuf.Duration start_offset = 1; + + // Time offset relative to the beginning of the audio that corresponds to the + // end of the spoken word. This is an experimental feature and the accuracy of + // the time offset can vary. + google.protobuf.Duration end_offset = 2; + + // The Speech confidence between 0.0 and 1.0 for this word. A higher number + // indicates an estimated greater likelihood that the recognized word is + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be fully stable over time for the same + // audio input. Users should also not rely on it to always be provided. + float confidence = 4; +} + +// Audio encoding of the audio content sent in the conversational query request. +// Refer to the +// [Cloud Speech API +// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more +// details. +enum AudioEncoding { + // Not specified. + AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + AUDIO_ENCODING_LINEAR_16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is lossless (therefore + // recognition is not compromised) and requires only about half the + // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and + // 24-bit samples, however, not all fields in `STREAMINFO` are supported. + AUDIO_ENCODING_FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + AUDIO_ENCODING_MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AUDIO_ENCODING_AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Dialogflow API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; +} + +// Instructs the speech recognizer on how to process the audio content. +message InputAudioConfig { + // Required. Audio encoding of the audio content to process. + AudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // Sample rate (in Hertz) of the audio content sent in the query. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics) for + // more details. + int32 sample_rate_hertz = 2; + + // Optional. If `true`, Dialogflow returns [SpeechWordInfo][google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo] in + // [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult] with information about the recognized speech + // words, e.g. start and end time offsets. If false or unspecified, Speech + // doesn't return any word-level information. + bool enable_word_info = 13; + + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + repeated string phrase_hints = 4; + + // Optional. Which Speech model to select for the given request. Select the + // model best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the InputAudioConfig. + // If enhanced speech model is enabled for the agent and an enhanced + // version of the specified model for the language does not exist, then the + // speech is recognized using the standard version of the specified model. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 7; + + // Optional. Which variant of the [Speech model][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.model] to use. + SpeechModelVariant model_variant = 10; + + // Optional. If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // Note: This setting is relevant only for streaming methods. + bool single_utterance = 8; +} + +// Variant of the specified [Speech model][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.model] to use. +// +// See the [Cloud Speech +// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) +// for which models have different variants. For example, the "phone_call" model +// has both a standard and an enhanced variant. When you use an enhanced model, +// you will generally receive higher quality results than for a standard model. +enum SpeechModelVariant { + // No model variant specified. In this case Dialogflow defaults to + // USE_BEST_AVAILABLE. + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; + + // Use the best available variant of the [Speech + // model][InputAudioConfig.model] that the caller is eligible for. + // + // Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) for + // how to make your project eligible for enhanced models. + USE_BEST_AVAILABLE = 1; + + // Use standard model variant even if an enhanced model is available. See the + // [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // for details about enhanced models. + USE_STANDARD = 2; + + // Use an enhanced model variant: + // + // * If an enhanced variant does not exist for the given + // [model][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.model] and request language, Dialogflow falls + // back to the standard variant. + // + // The [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // describes which models have enhanced variants. + // + // * If the API caller isn't eligible for enhanced models, Dialogflow returns + // an error. Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) + // for how to make your project eligible. + USE_ENHANCED = 3; +} + +// Description of which voice to use for speech synthesis. +message VoiceSelectionParams { + // Optional. The name of the voice. If not set, the service will choose a + // voice based on the other parameters such as language_code and + // [ssml_gender][google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.ssml_gender]. + string name = 1; + + // Optional. The preferred gender of the voice. If not set, the service will + // choose a voice based on the other parameters such as language_code and + // [name][google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.name]. Note that this is only a preference, not requirement. If a + // voice of the appropriate gender is not available, the synthesizer should + // substitute a voice with a different gender rather than failing the request. + SsmlVoiceGender ssml_gender = 2; +} + +// Configuration of how speech should be synthesized. +message SynthesizeSpeechConfig { + // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + // native speed supported by the specific voice. 2.0 is twice as fast, and + // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + // other values < 0.25 or > 4.0 will return an error. + double speaking_rate = 1; + + // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + // semitones from the original pitch. -20 means decrease 20 semitones from the + // original pitch. + double pitch = 2; + + // Optional. Volume gain (in dB) of the normal native volume supported by the + // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + // will play at approximately half the amplitude of the normal native signal + // amplitude. A value of +6.0 (dB) will play at approximately twice the + // amplitude of the normal native signal amplitude. We strongly recommend not + // to exceed +10 (dB) as there's usually no effective increase in loudness for + // any value greater than that. + double volume_gain_db = 3; + + // Optional. An identifier which selects 'audio effects' profiles that are + // applied on (post synthesized) text to speech. Effects are applied on top of + // each other in the order they are given. + repeated string effects_profile_id = 5; + + // Optional. The desired voice of the synthesized audio. + VoiceSelectionParams voice = 4; +} + +// Gender of the voice as described in +// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). +enum SsmlVoiceGender { + // An unspecified gender, which means that the client doesn't care which + // gender the selected voice will have. + SSML_VOICE_GENDER_UNSPECIFIED = 0; + + // A male voice. + SSML_VOICE_GENDER_MALE = 1; + + // A female voice. + SSML_VOICE_GENDER_FEMALE = 2; + + // A gender-neutral voice. + SSML_VOICE_GENDER_NEUTRAL = 3; +} + +// Instructs the speech synthesizer how to generate the output audio content. +message OutputAudioConfig { + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The synthesis sample rate (in hertz) for this audio. If not + // provided, then the synthesizer will use the default sample rate based on + // the audio encoding. If this is different from the voice's natural sample + // rate, then the synthesizer will honor this request by converting to the + // desired sample rate (which might result in worse audio quality). + int32 sample_rate_hertz = 2; + + // Optional. Configuration of how speech should be synthesized. + SynthesizeSpeechConfig synthesize_speech_config = 3; +} + +// Audio encoding of the output audio format in Text-To-Speech. +enum OutputAudioEncoding { + // Not specified. + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Audio content returned as LINEAR16 also contains a WAV header. + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + + // MP3 audio at 32kbps. + OUTPUT_AUDIO_ENCODING_MP3 = 2; + + // MP3 audio at 64kbps. + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + + // Opus encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android, and in browsers (at least + // Chrome and Firefox). The quality of the encoding is considerably higher + // than MP3 while using approximately the same bitrate. + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + OUTPUT_AUDIO_ENCODING_MULAW = 5; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto b/protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto new file mode 100644 index 00000000..8c5571a1 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto @@ -0,0 +1,354 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "EntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [EntityTypes][google.cloud.dialogflow.cx.v3beta1.EntityType]. +service EntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all entity types in the specified agent. + rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified entity type. + rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/entityTypes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an entity type in the specified agent. + rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes" + body: "entity_type" + }; + option (google.api.method_signature) = "parent,entity_type"; + } + + // Updates the specified entity type. + rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + patch: "/v3beta1/{entity_type.name=projects/*/locations/*/agents/*/entityTypes/*}" + body: "entity_type" + }; + option (google.api.method_signature) = "entity_type,update_mask"; + } + + // Deletes the specified entity type. + rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/entityTypes/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Entities are extracted from user input and represent parameters that are +// meaningful to your application. For example, a date range, a proper name +// such as a geographic location or landmark, and so on. Entities represent +// actionable data for your application. +// +// When you define an entity, you can also include synonyms that all map to +// that entity. For example, "soft drink", "soda", "pop", and so on. +// +// There are three types of entities: +// +// * **System** - entities that are defined by the Dialogflow API for common +// data types such as date, time, currency, and so on. A system entity is +// represented by the `EntityType` type. +// +// * **Custom** - entities that are defined by you that represent +// actionable data that is meaningful to your application. For example, +// you could define a `pizza.sauce` entity for red or white pizza sauce, +// a `pizza.cheese` entity for the different types of cheese on a pizza, +// a `pizza.topping` entity for different toppings, and so on. A custom +// entity is represented by the `EntityType` type. +// +// * **User** - entities that are built for an individual user such as +// favorites, preferences, playlists, and so on. A user entity is +// represented by the [SessionEntityType][google.cloud.dialogflow.cx.v3beta1.SessionEntityType] type. +// +// For more information about entity types, see the [Dialogflow +// documentation](https://cloud.google.com/dialogflow/docs/entities-overview). +message EntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/EntityType" + pattern: "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}" + }; + + // An **entity entry** for an associated entity type. + // Next Id = 8 + message Entity { + // Required. The primary value associated with this entity entry. + // For example, if the entity type is *vegetable*, the value could be + // *scallions*. + // + // For `KIND_MAP` entity types: + // + // * A canonical value to be used in place of synonyms. + // + // For `KIND_LIST` entity types: + // + // * A string that can contain references to other entity types (with or + // without aliases). + string value = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A collection of value synonyms. For example, if the entity type + // is *vegetable*, and `value` is *scallions*, a synonym could be *green + // onions*. + // + // For `KIND_LIST` entity types: + // + // * This collection must contain exactly one synonym equal to `value`. + repeated string synonyms = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // An excluded entity phrase that should not be matched. + message ExcludedPhrase { + // Required. The word or phrase to be excluded. + string value = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Represents kinds of entities. + enum Kind { + // Not specified. This value should be never used. + KIND_UNSPECIFIED = 0; + + // Map entity types allow mapping of a group of synonyms to a canonical + // value. + KIND_MAP = 1; + + // List entity types contain a set of entries that do not map to canonical + // values. However, list entity types can contain references to other entity + // types (with or without aliases). + KIND_LIST = 2; + + // Regexp entity types allow to specify regular expressions in entries + // values. + KIND_REGEXP = 3; + } + + // Represents different entity type expansion modes. Automated expansion + // allows an agent to recognize values that have not been explicitly listed in + // the entity (for example, new kinds of shopping list items). + enum AutoExpansionMode { + // Auto expansion disabled for the entity. + AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + + // Allows an agent to recognize values that have not been explicitly + // listed in the entity. + AUTO_EXPANSION_MODE_DEFAULT = 1; + } + + // The unique identifier of the entity type. + // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.cx.v3beta1.EntityTypes.UpdateEntityType]. + // Format: `projects//locations//agents//entityTypes/`. + string name = 1; + + // Required. The human-readable name of the entity type, unique within the agent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates the kind of entity type. + Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; + + // Indicates whether the entity type can be automatically expanded. + AutoExpansionMode auto_expansion_mode = 4; + + // The collection of entity entries associated with the entity type. + repeated Entity entities = 5; + + // Collection of exceptional words and phrases that shouldn't be matched. + // For example, if you have a size entity type with entry `giant`(an + // adjective), you might consider adding `giants`(a noun) as an exclusion. + // If the kind of entity type is `KIND_MAP`, then the phrases specified by + // entities and excluded phrases should be mutually exclusive. + repeated ExcludedPhrase excluded_phrases = 6; + + // Enables fuzzy entity extraction during classification. + bool enable_fuzzy_extraction = 7; +} + +// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.cx.v3beta1.EntityTypes.ListEntityTypes]. +message ListEntityTypesRequest { + // Required. The agent to list all entity types for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // The language to list entity types for. The following fields are language + // dependent: + // + // * `EntityType.entities.value` + // * `EntityType.entities.synonyms` + // * `EntityType.excluded_phrases.value` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 3; + + // The next_page_token value returned from a previous list request. + string page_token = 4; +} + +// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.cx.v3beta1.EntityTypes.ListEntityTypes]. +message ListEntityTypesResponse { + // The list of entity types. There will be a maximum number of items returned + // based on the page_size field in the request. + repeated EntityType entity_types = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.cx.v3beta1.EntityTypes.GetEntityType]. +message GetEntityTypeRequest { + // Required. The name of the entity type. + // Format: `projects//locations//agents//entityTypes/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // The language to retrieve the entity type for. The following fields are + // language dependent: + // + // * `EntityType.entities.value` + // * `EntityType.entities.synonyms` + // * `EntityType.excluded_phrases.value` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; +} + +// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.cx.v3beta1.EntityTypes.CreateEntityType]. +message CreateEntityTypeRequest { + // Required. The agent to create a entity type for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entity type to create. + EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `entity_type`: + // + // * `EntityType.entities.value` + // * `EntityType.entities.synonyms` + // * `EntityType.excluded_phrases.value` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.cx.v3beta1.EntityTypes.UpdateEntityType]. +message UpdateEntityTypeRequest { + // Required. The entity type to update. + EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `entity_type`: + // + // * `EntityType.entities.value` + // * `EntityType.entities.synonyms` + // * `EntityType.excluded_phrases.value` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; + + // The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.cx.v3beta1.EntityTypes.DeleteEntityType]. +message DeleteEntityTypeRequest { + // Required. The name of the entity type to delete. + // Format: `projects//locations//agents//entityTypes/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // This field has no effect for entity type not being used. + // For entity types that are used by intents or pages: + // + // * If `force` is set to false, an error will be returned with message + // indicating the referencing resources. + // * If `force` is set to true, Dialogflow will remove the entity type, as + // well as any references to the entity type (i.e. Page + // [parameter][google.cloud.dialogflow.cx.v3beta1.Form.Parameter] of the entity type will be changed to + // '@sys.any' and intent [parameter][google.cloud.dialogflow.cx.v3beta1.Intent.Parameter] of the entity type + // will be removed). + bool force = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/environment.proto b/protos/google/cloud/dialogflow/cx/v3beta1/environment.proto new file mode 100644 index 00000000..a5c444c3 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/environment.proto @@ -0,0 +1,262 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Environments][google.cloud.dialogflow.cx.v3beta1.Environment]. +service Environments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all environments in the specified [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. + rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/environments" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. + rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] in the specified [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. + rpc CreateEnvironment(CreateEnvironmentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/environments" + body: "environment" + }; + option (google.api.method_signature) = "parent,environment"; + option (google.longrunning.operation_info) = { + response_type: "Environment" + metadata_type: "google.protobuf.Struct" + }; + } + + // Updates the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. + rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v3beta1/{environment.name=projects/*/locations/*/agents/*/environments/*}" + body: "environment" + }; + option (google.api.method_signature) = "environment,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Environment" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. + rpc LookupEnvironmentHistory(LookupEnvironmentHistoryRequest) returns (LookupEnvironmentHistoryResponse) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}:lookupEnvironmentHistory" + }; + option (google.api.method_signature) = "name"; + } +} + +// Represents an environment for an agent. You can create multiple versions +// of your agent and publish them to separate environments. When you edit an +// agent, you are editing the draft agent. At any point, you can save the draft +// agent as an agent version, which is an immutable snapshot of your agent. When +// you save the draft agent, it is published to the default environment. When +// you create agent versions, you can publish them to custom environments. You +// can create a variety of custom environments for testing, development, +// production, etc. +message Environment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Environment" + pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}" + }; + + // Configuration for the version. + message VersionConfig { + // Required. Format: projects//locations//agents//flows//versions/. + string version = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + } + + // The name of the environment. + // Format: `projects//locations//agents//environments/`. + string name = 1; + + // Required. The human-readable name of the environment (unique in an agent). Limit of + // 64 characters. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The human-readable description of the environment. The maximum length is + // 500 characters. If exceeded, the request is rejected. + string description = 3; + + // Required. A list of configurations for flow versions. You should include version + // configs for all flows that are reachable from [`Start + // Flow`][Agent.start_flow] in the agent. Otherwise, an error will be + // returned. + repeated VersionConfig version_configs = 6 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Update time of this environment. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.cx.v3beta1.Environments.ListEnvironments]. +message ListEnvironmentsRequest { + // Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to list all environments for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // The maximum number of items to return in a single page. By default 20 and + // at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.cx.v3beta1.Environments.ListEnvironments]. +message ListEnvironmentsResponse { + // The list of environments. There will be a maximum number of items + // returned based on the page_size field in the request. The list may in some + // cases be empty or contain fewer entries than page_size even if this isn't + // the last page. + repeated Environment environments = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [Environments.GetEnvironment][google.cloud.dialogflow.cx.v3beta1.Environments.GetEnvironment]. +message GetEnvironmentRequest { + // Required. The name of the [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. + // Format: `projects//locations//agents//environments/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.cx.v3beta1.Environments.CreateEnvironment]. +message CreateEnvironmentRequest { + // Required. The [Agent][google.cloud.dialogflow.cx.v3beta1.Agent] to create an [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Required. The environment to create. + Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.cx.v3beta1.Environments.UpdateEnvironment]. +message UpdateEnvironmentRequest { + // Required. The environment to update. + Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.cx.v3beta1.Environments.DeleteEnvironment]. +message DeleteEnvironmentRequest { + // Required. The name of the [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] to delete. + // Format: `projects//locations//agents//environments/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.LookupEnvironmentHistory][google.cloud.dialogflow.cx.v3beta1.Environments.LookupEnvironmentHistory]. +message LookupEnvironmentHistoryRequest { + // Required. Resource name of the environment to look up the history for. + // Format: `projects//locations//agents//environments/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Environments.LookupEnvironmentHistory][google.cloud.dialogflow.cx.v3beta1.Environments.LookupEnvironmentHistory]. +message LookupEnvironmentHistoryResponse { + // Represents a list of snapshots for an environment. Time of the snapshots is + // stored in [`update_time`][google.cloud.dialogflow.cx.v3beta1.Environment.update_time]. + repeated Environment environments = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto b/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto new file mode 100644 index 00000000..fefd0abe --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/flow.proto @@ -0,0 +1,366 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/page.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "FlowProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Flows][google.cloud.dialogflow.cx.v3beta1.Flow]. +service Flows { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a flow in the specified agent. + rpc CreateFlow(CreateFlowRequest) returns (Flow) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows" + body: "flow" + }; + option (google.api.method_signature) = "parent,flow"; + } + + // Deletes a specified flow. + rpc DeleteFlow(DeleteFlowRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all flows in the specified agent. + rpc ListFlows(ListFlowsRequest) returns (ListFlowsResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified flow. + rpc GetFlow(GetFlowRequest) returns (Flow) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the specified flow. + rpc UpdateFlow(UpdateFlowRequest) returns (Flow) { + option (google.api.http) = { + patch: "/v3beta1/{flow.name=projects/*/locations/*/agents/*/flows/*}" + body: "flow" + }; + option (google.api.method_signature) = "flow,update_mask"; + } + + // Trains the specified flow. Note that only the flow in 'draft' environment + // is trained. + rpc TrainFlow(TrainFlowRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}:train" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Settings related to NLU. +message NluSettings { + // NLU model type. + enum ModelType { + // Not specified. `MODEL_TYPE_STANDARD` will be used. + MODEL_TYPE_UNSPECIFIED = 0; + + // Use standard NLU model. + MODEL_TYPE_STANDARD = 1; + + // Use advanced NLU model. + MODEL_TYPE_ADVANCED = 3; + } + + // NLU model training mode. + enum ModelTrainingMode { + // Not specified. `MODEL_TRAINING_MODE_AUTOMATIC` will be used. + MODEL_TRAINING_MODE_UNSPECIFIED = 0; + + // NLU model training is automatically triggered when a flow gets modified. + // User can also manually trigger model training in this mode. + MODEL_TRAINING_MODE_AUTOMATIC = 1; + + // User needs to manually trigger NLU model training. Best for large flows + // whose models take long time to train. + MODEL_TRAINING_MODE_MANUAL = 2; + } + + // Indicates the type of NLU model. + ModelType model_type = 1; + + // To filter out false positive results and still get variety in matched + // natural language inputs for your agent, you can tune the machine learning + // classification threshold. If the returned score value is less than the + // threshold value, then a no-match event will be triggered. The score values + // range from 0.0 (completely uncertain) to 1.0 (completely certain). If set + // to 0.0, the default of 0.3 is used. + float classification_threshold = 3; + + // Indicates NLU model training mode. + ModelTrainingMode model_training_mode = 4; +} + +// Flows represents the conversation flows when you build your chatbot agent. +// +// A flow consists of many pages connected by the transition routes. +// Conversations always start with the built-in Start Flow (with an all-0 ID). +// Transition routes can direct the conversation session from the current flow +// (parent flow) to another flow (sub flow). When the sub flow is finished, +// Dialogflow will bring the session back to the parent flow, where the sub flow +// is started. +// +// Usually, when a transition route is followed by a matched intent, the intent +// will be "consumed". This means the intent won't activate more transition +// routes. However, when the followed transition route moves the conversation +// session into a different flow, the matched intent can be carried over and to +// be consumed in the target flow. +message Flow { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Flow" + pattern: "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}" + }; + + // The unique identifier of the flow. + // Format: `projects//locations//agents//flows/`. + string name = 1; + + // Required. The human-readable name of the flow. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The description of the flow. The maximum length is 500 characters. If + // exceeded, the request is rejected. + string description = 3; + + // A flow's transition routes serve two purposes: + // + // * They are responsible for matching the user's first utterances in the + // flow. + // * They are inherited by every page's [transition + // routes][Page.transition_routes] and can support use cases such as the user + // saying "help" or "can I talk to a human?", which can be handled in a common + // way regardless of the current page. Transition routes defined in the page + // have higher priority than those defined in the flow. + // + // TransitionRoutes are evalauted in the following order: + // + // * TransitionRoutes with intent specified.. + // * TransitionRoutes with only condition specified. + // + // TransitionRoutes with intent specified are inherited by pages in the flow. + repeated TransitionRoute transition_routes = 4; + + // A flow's event handlers serve two purposes: + // + // * They are responsible for handling events (e.g. no match, + // webhook errors) in the flow. + // * They are inherited by every page's [event + // handlers][Page.event_handlers], which can be used to handle common events + // regardless of the current page. Event handlers defined in the page + // have higher priority than those defined in the flow. + // + // Unlike [transition_routes][google.cloud.dialogflow.cx.v3beta1.Flow.transition_routes], these handlers are + // evaluated on a first-match basis. The first one that matches the event + // get executed, with the rest being ignored. + repeated EventHandler event_handlers = 10; + + // NLU related settings of the flow. + NluSettings nlu_settings = 11; +} + +// The request message for [Flows.CreateFlow][google.cloud.dialogflow.cx.v3beta1.Flows.CreateFlow]. +message CreateFlowRequest { + // Required. The agent to create a flow for. + // 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 create. + Flow flow = 2 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `flow`: + // + // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [Flows.DeleteFlow][google.cloud.dialogflow.cx.v3beta1.Flows.DeleteFlow]. +message DeleteFlowRequest { + // Required. The name of the flow to delete. + // Format: `projects//locations//agents//flows/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + } + ]; + + // This field has no effect for flows with no incoming transitions. + // For flows with incoming transitions: + // + // * If `force` is set to false, an error will be returned with message + // indicating the incoming transitions. + // * If `force` is set to true, Dialogflow will remove the flow, as well as + // any transitions to the flow (i.e. [Target + // flow][EventHandler.target_flow] in event handlers or [Target + // flow][TransitionRoute.target_flow] in transition routes that point to + // this flow will be cleared). + bool force = 2; +} + +// The request message for [Flows.ListFlows][google.cloud.dialogflow.cx.v3beta1.Flows.ListFlows]. +message ListFlowsRequest { + // Required. The agent containing the flows. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Flow" + } + ]; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The language to list flows for. The following fields are language + // dependent: + // + // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 4; +} + +// The response message for [Flows.ListFlows][google.cloud.dialogflow.cx.v3beta1.Flows.ListFlows]. +message ListFlowsResponse { + // The list of flows. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Flow flows = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The response message for [Flows.GetFlow][google.cloud.dialogflow.cx.v3beta1.Flows.GetFlow]. +message GetFlowRequest { + // Required. The name of the flow to get. + // Format: `projects//locations//agents//flows/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + } + ]; + + // The language to retrieve the flow for. The following fields are language + // dependent: + // + // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; +} + +// The request message for [Flows.UpdateFlow][google.cloud.dialogflow.cx.v3beta1.Flows.UpdateFlow]. +message UpdateFlowRequest { + // Required. The flow to update. + Flow flow = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. If `update_mask` is not + // specified, an error will be returned. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `flow`: + // + // * `Flow.event_handlers.trigger_fulfillment.messages` + // * `Flow.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [Flows.TrainFlow][google.cloud.dialogflow.cx.v3beta1.Flows.TrainFlow]. +message TrainFlowRequest { + // Required. The flow to train. + // Format: `projects//locations//agents//flows/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + } + ]; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto b/protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto new file mode 100644 index 00000000..7a8e5af3 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto @@ -0,0 +1,107 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.cx.v3beta1; + +import "google/api/resource.proto"; +import "google/cloud/dialogflow/cx/v3beta1/response_message.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "FulfillmentProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// A fulfillment can do one or more of the following actions at the same time: +// +// * Generate rich message responses. +// * Set parameter values. +// * Call the webhook. +// +// Fulfillments can be called at various stages in the [Page][google.cloud.dialogflow.cx.v3beta1.Page] or +// [Form][google.cloud.dialogflow.cx.v3beta1.Form] lifecycle. For example, when a [DetectIntentRequest][google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest] drives a +// session to enter a new page, the page's entry fulfillment can add a static +// response to the [QueryResult][google.cloud.dialogflow.cx.v3beta1.QueryResult] in the returning [DetectIntentResponse][google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse], +// call the webhook (for example, to load user data from a database), or both. +message Fulfillment { + // Setting a parameter value. + message SetParameterAction { + // Display name of the parameter. + string parameter = 1; + + // The new value of the parameter. A null value clears the parameter. + google.protobuf.Value value = 2; + } + + // A list of cascading if-else conditions. Cases are mutually exclusive. + // The first one with a matching condition is selected, all the rest ignored. + message ConditionalCases { + // Each case has a Boolean condition. When it is evaluated to be True, the + // corresponding messages will be selected and evaluated recursively. + message Case { + // The list of messages or conditional cases to activate for this case. + message CaseContent { + // Either a message is returned or additional cases to be evaluated. + oneof cases_or_message { + // Returned message. + ResponseMessage message = 1; + + // Additional cases to be evaluated. + ConditionalCases additional_cases = 2; + } + } + + // The condition to activate and select this case. Empty means the + // condition is always true. The condition is evaluated against [form + // parameters][Form.parameters] or [session + // parameters][SessionInfo.parameters]. + // + // See the [conditions + // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + string condition = 1; + + // A list of case content. + repeated CaseContent case_content = 2; + } + + // A list of cascading if-else conditions. + repeated Case cases = 1; + } + + // The list of rich message responses to present to the user. + repeated ResponseMessage messages = 1; + + // The webhook to call. + // Format: `projects//locations//agents//webhooks/`. + string webhook = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Webhook" + }]; + + // The tag used by the webhook to identify which fulfillment is being called. + // This field is required if `webhook` is specified. + string tag = 3; + + // Set parameter values before executing the webhook. + repeated SetParameterAction set_parameter_actions = 4; + + // Conditional cases for this fulfillment. + repeated ConditionalCases conditional_cases = 5; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/intent.proto b/protos/google/cloud/dialogflow/cx/v3beta1/intent.proto new file mode 100644 index 00000000..53b74fae --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/intent.proto @@ -0,0 +1,360 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Intents][google.cloud.dialogflow.cx.v3beta1.Intent]. +service Intents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all intents in the specified agent. + rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/intents" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified intent. + rpc GetIntent(GetIntentRequest) returns (Intent) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/intents/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an intent in the specified agent. + rpc CreateIntent(CreateIntentRequest) returns (Intent) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/intents" + body: "intent" + }; + option (google.api.method_signature) = "parent,intent"; + } + + // Updates the specified intent. + rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { + option (google.api.http) = { + patch: "/v3beta1/{intent.name=projects/*/locations/*/agents/*/intents/*}" + body: "intent" + }; + option (google.api.method_signature) = "intent,update_mask"; + } + + // Deletes the specified intent. + rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/intents/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// An intent represents a user's intent to interact with a conversational agent. +// +// You can provide information for the Dialogflow API to use to match user input +// to an intent by adding training phrases (i.e., examples of user input) to +// your intent. +message Intent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Intent" + pattern: "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}" + }; + + // Represents an example that the agent is trained on to identify the intent. + message TrainingPhrase { + // Represents a part of a training phrase. + message Part { + // Required. The text for this part. + string text = 1 [(google.api.field_behavior) = REQUIRED]; + + // The [parameter][google.cloud.dialogflow.cx.v3beta1.Intent.Parameter] used to annotate this part of the + // training phrase. This field is required for annotated parts of the + // training phrase. + string parameter_id = 2; + } + + // Output only. The unique identifier of the training phrase. + string id = 1; + + // Required. The ordered list of training phrase parts. + // The parts are concatenated in order to form the training phrase. + // + // Note: The API does not automatically annotate training phrases like the + // Dialogflow Console does. + // + // Note: Do not forget to include whitespace at part boundaries, so the + // training phrase is well formatted when the parts are concatenated. + // + // If the training phrase does not need to be annotated with parameters, + // you just need a single part with only the [Part.text][google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.text] field set. + // + // If you want to annotate the training phrase, you must create multiple + // parts, where the fields of each part are populated in one of two ways: + // + // - `Part.text` is set to a part of the phrase that has no parameters. + // - `Part.text` is set to a part of the phrase that you want to annotate, + // and the `parameter_id` field is set. + repeated Part parts = 2 [(google.api.field_behavior) = REQUIRED]; + + // Indicates how many times this example was added to the intent. + int32 repeat_count = 3; + } + + // Represents an intent parameter. + message Parameter { + // Required. The unique identifier of the parameter. This field + // is used by [training phrases][google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase] to annotate their + // [parts][google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part]. + string id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The entity type of the parameter. + // Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + // `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + // `projects//locations//agents//entityTypes/` for developer entity types. + string entity_type = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Indicates whether the parameter represents a list of values. + bool is_list = 3; + + // Indicates whether the parameter content is logged in text and audio. If + // it is set to true, the parameter content will be replaced to parameter + // id in both request and response. The default value is false. + bool redact = 4; + } + + // The unique identifier of the intent. + // Required for the [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntent] method. [Intents.CreateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntent] + // populates the name automatically. + // Format: `projects//locations//agents//intents/`. + string name = 1; + + // Required. The human-readable name of the intent, unique within the agent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The collection of training phrases the agent is trained on to identify the + // intent. + repeated TrainingPhrase training_phrases = 3; + + // The collection of parameters associated with the intent. + repeated Parameter parameters = 4; + + // The priority of this intent. Higher numbers represent higher + // priorities. + // + // - If the supplied value is unspecified or 0, the service + // translates the value to 500,000, which corresponds to the + // `Normal` priority in the console. + // - If the supplied value is negative, the intent is ignored + // in runtime detect intent requests. + int32 priority = 5; + + // Indicates whether this is a fallback intent. Currently only default + // fallback intent is allowed in the agent, which is added upon agent + // creation. + // Adding training phrases to fallback intent is useful in the case of + // requests that are mistakenly matched, since training phrases assigned to + // fallback intents act as negative examples that triggers no-match event. + bool is_fallback = 6; + + // Optional. The key/value metadata to label an intent. Labels can contain + // lowercase letters, digits and the symbols '-' and '_'. International + // characters are allowed, including letters from unicase alphabets. Keys must + // start with a letter. Keys and values can be no longer than 63 characters + // and no more than 128 bytes. + // + // Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed + // Dialogflow defined labels include: + // * sys-head + // * sys-contextual + // The above labels do not require value. "sys-head" means the intent is a + // head intent. "sys-contextual" means the intent is a contextual intent. + map labels = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Human readable description for better understanding an intent like its + // scope, content, result etc. Maximum character limit: 140 characters. + string description = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.ListIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ListIntents]. +message ListIntentsRequest { + // Required. The agent to list all intents for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // The language to list intents for. The following fields are language + // dependent: + // + // * `Intent.training_phrases.parts.text` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; + + // The resource view to apply to the returned intent. + IntentView intent_view = 5; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 3; + + // The next_page_token value returned from a previous list request. + string page_token = 4; +} + +// The response message for [Intents.ListIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ListIntents]. +message ListIntentsResponse { + // The list of intents. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Intent intents = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [Intents.GetIntent][google.cloud.dialogflow.cx.v3beta1.Intents.GetIntent]. +message GetIntentRequest { + // Required. The name of the intent. + // Format: `projects//locations//agents//intents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; + + // The language to retrieve the intent for. The following fields are language + // dependent: + // + // * `Intent.training_phrases.parts.text` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; +} + +// The request message for [Intents.CreateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntent]. +message CreateIntentRequest { + // Required. The agent to create an intent for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The intent to create. + Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `intent`: + // + // * `Intent.training_phrases.parts.text` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntent]. +message UpdateIntentRequest { + // Required. The intent to update. + Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `intent`: + // + // * `Intent.training_phrases.parts.text` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; + + // The mask to control which fields get updated. If the mask is not present, + // all fields will be updated. + google.protobuf.FieldMask update_mask = 3; +} + +// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.cx.v3beta1.Intents.DeleteIntent]. +message DeleteIntentRequest { + // Required. The name of the intent to delete. + // Format: `projects//locations//agents//intents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; +} + +// Represents the options for views of an intent. +// An intent can be a sizable object. Therefore, we provide a resource view that +// does not return training phrases in the response. +enum IntentView { + // Not specified. Treated as INTENT_VIEW_FULL. + INTENT_VIEW_UNSPECIFIED = 0; + + // Training phrases field is not populated in the response. + INTENT_VIEW_PARTIAL = 1; + + // All fields are populated. + INTENT_VIEW_FULL = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/page.proto b/protos/google/cloud/dialogflow/cx/v3beta1/page.proto new file mode 100644 index 00000000..f63dcfae --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/page.proto @@ -0,0 +1,514 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/fulfillment.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "PageProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Pages][google.cloud.dialogflow.cx.v3beta1.Page]. +service Pages { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all pages in the specified flow. + rpc ListPages(ListPagesRequest) returns (ListPagesResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/pages" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified page. + rpc GetPage(GetPageRequest) returns (Page) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/pages/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a page in the specified flow. + rpc CreatePage(CreatePageRequest) returns (Page) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/pages" + body: "page" + }; + option (google.api.method_signature) = "parent,page"; + } + + // Updates the specified page. + rpc UpdatePage(UpdatePageRequest) returns (Page) { + option (google.api.http) = { + patch: "/v3beta1/{page.name=projects/*/locations/*/agents/*/flows/*/pages/*}" + body: "page" + }; + option (google.api.method_signature) = "page,update_mask"; + } + + // Deletes the specified page. + rpc DeletePage(DeletePageRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/pages/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// A Dialogflow CX conversation (session) can be described and visualized as a +// state machine. The states of a CX session are represented by pages. +// +// For each flow, you define many pages, where your combined pages can handle a +// complete conversation on the topics the flow is designed for. At any given +// moment, exactly one page is the current page, the current page is considered +// active, and the flow associated with that page is considered active. Every +// flow has a special start page. When a flow initially becomes active, the +// start page page becomes the current page. For each conversational turn, the +// current page will either stay the same or transition to another page. +// +// You configure each page to collect information from the end-user that is +// relevant for the conversational state represented by the page. +// +// For more information, see the +// [Page guide](https://cloud.google.com/dialogflow/cx/docs/concept/page). +message Page { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Page" + pattern: "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}" + }; + + // The unique identifier of the page. + // Required for the [Pages.UpdatePage][google.cloud.dialogflow.cx.v3beta1.Pages.UpdatePage] method. [Pages.CreatePage][google.cloud.dialogflow.cx.v3beta1.Pages.CreatePage] + // populates the name automatically. + // Format: `projects//locations//agents//flows//pages/`. + string name = 1; + + // Required. The human-readable name of the page, unique within the agent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The fulfillment to call when the session is entering the page. + Fulfillment entry_fulfillment = 7; + + // The form associated with the page, used for collecting parameters + // relevant to the page. + Form form = 4; + + // Ordered list of [`TransitionRouteGroups`][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] associated + // with the page. Transition route groups must be unique within a page. + // + // * If multiple transition routes within a page scope refer to the same + // intent, then the precedence order is: page's transition route -> page's + // transition route group -> flow's transition routes. + // + // * If multiple transition route groups within a page contain the same + // intent, then the first group in the ordered list takes precedence. + // + // Format:`projects//locations//agents//flows//transitionRouteGroups/`. + repeated string transition_route_groups = 11 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/TransitionRouteGroup" + }]; + + // A list of transitions for the transition rules of this page. + // They route the conversation to another page in the same flow, or another + // flow. + // + // When we are in a certain page, the TransitionRoutes are evalauted in the + // following order: + // + // * TransitionRoutes defined in the page with intent specified. + // * TransitionRoutes defined in the + // [transition route groups][google.cloud.dialogflow.cx.v3beta1.Page.transition_route_groups]. + // * TransitionRoutes defined in flow with intent specified. + // * TransitionRoutes defined in the page with only condition specified. + repeated TransitionRoute transition_routes = 9; + + // Handlers associated with the page to handle events such as webhook errors, + // no match or no input. + repeated EventHandler event_handlers = 10; +} + +// A form is a data model that groups related parameters that can be collected +// from the user. The process in which the agent prompts the user and collects +// parameter values from the user is called form filling. A form can be added to +// a [page][google.cloud.dialogflow.cx.v3beta1.Page]. When form filling is done, the filled parameters will be +// written to the [session][google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters]. +message Form { + // Represents a form parameter. + message Parameter { + // Configuration for how the filling of a parameter should be handled. + message FillBehavior { + // Required. The fulfillment to provide the initial prompt that the agent + // can present to the user in order to fill the parameter. + Fulfillment initial_prompt_fulfillment = 3 [(google.api.field_behavior) = REQUIRED]; + + // The handlers for parameter-level events, used to provide reprompt for + // the parameter or transition to a different page/flow. The supported + // events are: + // * `sys.no-match-`, where N can be from 1 to 6 + // * `sys.no-match-default` + // * `sys.no-input-`, where N can be from 1 to 6 + // * `sys.no-input-default` + // * `sys.invalid-parameter` + // + // `initial_prompt_fulfillment` provides the first prompt for the + // parameter. + // + // If the user's response does not fill the parameter, a + // no-match/no-input event will be triggered, and the fulfillment + // associated with the `sys.no-match-1`/`sys.no-input-1` handler (if + // defined) will be called to provide a prompt. The + // `sys.no-match-2`/`sys.no-input-2` handler (if defined) will respond to + // the next no-match/no-input event, and so on. + // + // A `sys.no-match-default` or `sys.no-input-default` handler will be used + // to handle all following no-match/no-input events after all numbered + // no-match/no-input handlers for the parameter are consumed. + // + // A `sys.invalid-parameter` handler can be defined to handle the case + // where the parameter values have been `invalidated` by webhook. For + // example, if the user's response fill the parameter, however the + // parameter was invalidated by webhook, the fulfillment associated with + // the `sys.invalid-parameter` handler (if defined) will be called to + // provide a prompt. + // + // If the event handler for the corresponding event can't be found on the + // parameter, `initial_prompt_fulfillment` will be re-prompted. + repeated EventHandler reprompt_event_handlers = 5; + } + + // Required. The human-readable name of the parameter, unique within the + // form. + string display_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates whether the parameter is required. Optional parameters will not + // trigger prompts; however, they are filled if the user specifies them. + // Required parameters must be filled before form filling concludes. + bool required = 2; + + // Required. The entity type of the parameter. + // Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + // `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + // `projects//locations//agents//entityTypes/` for developer entity types. + string entity_type = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Indicates whether the parameter represents a list of values. + bool is_list = 4; + + // Required. Defines fill behavior for the parameter. + FillBehavior fill_behavior = 7 [(google.api.field_behavior) = REQUIRED]; + + // The default value of an optional parameter. If the parameter is required, + // the default value will be ignored. + google.protobuf.Value default_value = 9; + + // Indicates whether the parameter content is logged in text and audio. If + // it is set to true, the parameter content will be replaced to parameter + // name in both request and response. The default value is false. + bool redact = 11; + } + + // Parameters to collect from the user. + repeated Parameter parameters = 1; +} + +// An event handler specifies an [event][google.cloud.dialogflow.cx.v3beta1.EventHandler.event] that can be handled +// during a session. When the specified event happens, the following actions are +// taken in order: +// +// * If there is a +// [`trigger_fulfillment`][google.cloud.dialogflow.cx.v3beta1.EventHandler.trigger_fulfillment] associated with +// the event, it will be called. +// * If there is a [`target_page`][google.cloud.dialogflow.cx.v3beta1.EventHandler.target_page] associated +// with the event, the session will transition into the specified page. +// * If there is a [`target_flow`][google.cloud.dialogflow.cx.v3beta1.EventHandler.target_flow] associated +// with the event, the session will transition into the specified flow. +message EventHandler { + // Output only. The unique identifier of this event handler. + string name = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The name of the event to handle. + string event = 4 [(google.api.field_behavior) = REQUIRED]; + + // The fulfillment to call when the event occurs. + // Handling webhook errors with a fulfillment enabled with webhook could + // cause infinite loop. It is invalid to specify such fulfillment for a + // handler handling webhooks. + Fulfillment trigger_fulfillment = 5; + + // The target to transition to, either a page in the same host flow (the flow + // that owns this [TransitionRoute][google.cloud.dialogflow.cx.v3beta1.TransitionRoute]), or another flow in the same agent. + oneof target { + // The target page to transition to. + // Format: `projects//locations//agents//flows//pages/`. + string target_page = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Page" + }]; + + // The target flow to transition to. + // Format: `projects//locations//agents//flows/`. + string target_flow = 3 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + }]; + } +} + +// A transition route specifies a [intent][google.cloud.dialogflow.cx.v3beta1.Intent] that can be matched and/or a +// data condition that can be evaluated during a session. When a specified +// transition is matched, the following actions are taken in order: +// +// * If there is a +// [`trigger_fulfillment`][google.cloud.dialogflow.cx.v3beta1.TransitionRoute.trigger_fulfillment] associated with +// the transition, it will be called. +// * If there is a [`target_page`][google.cloud.dialogflow.cx.v3beta1.TransitionRoute.target_page] associated +// with the transition, the session will transition into the specified page. +// * If there is a [`target_flow`][google.cloud.dialogflow.cx.v3beta1.TransitionRoute.target_flow] associated +// with the transition, the session will transition into the specified flow. +message TransitionRoute { + // Output only. The unique identifier of this transition route. + string name = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The unique identifier of an [Intent][google.cloud.dialogflow.cx.v3beta1.Intent]. + // Format: `projects//locations//agents//intents/`. + // Indicates that the transition can only happen when the given intent is + // matched. + // At least one of `intent` or `condition` must be specified. When both + // `intent` and `condition` are specified, the transition can only happen + // when both are fulfilled. + string intent = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + }]; + + // The condition to evaluate against [form parameters][google.cloud.dialogflow.cx.v3beta1.Form.parameters] or + // [session parameters][google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters]. + // + // See the [conditions + // reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + // At least one of `intent` or `condition` must be specified. When both + // `intent` and `condition` are specified, the transition can only happen + // when both are fulfilled. + string condition = 2; + + // The fulfillment to call when the condition is satisfied. At least one of + // `trigger_fulfillment` and `target` must be specified. When both are + // defined, `trigger_fulfillment` is executed first. + Fulfillment trigger_fulfillment = 3; + + // The target to transition to, either a page in the same host flow (the flow + // that owns this [TransitionRoute][google.cloud.dialogflow.cx.v3beta1.TransitionRoute]), or another flow in the same agent. + oneof target { + // The target page to transition to. + // Format: `projects//locations//agents//flows//pages/`. + string target_page = 4 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Page" + }]; + + // The target flow to transition to. + // Format: `projects//locations//agents//flows/`. + string target_flow = 5 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + }]; + } +} + +// The request message for [Pages.ListPages][google.cloud.dialogflow.cx.v3beta1.Pages.ListPages]. +message ListPagesRequest { + // Required. The flow to list all pages for. + // Format: `projects//locations//agents//flows/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Page" + } + ]; + + // The language to list pages for. The following fields are language + // dependent: + // + // * `Page.entry_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * + // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 3; + + // The next_page_token value returned from a previous list request. + string page_token = 4; +} + +// The response message for [Pages.ListPages][google.cloud.dialogflow.cx.v3beta1.Pages.ListPages]. +message ListPagesResponse { + // The list of pages. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Page pages = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [Pages.GetPage][google.cloud.dialogflow.cx.v3beta1.Pages.GetPage]. +message GetPageRequest { + // Required. The name of the page. + // Format: `projects//locations//agents//flows//pages/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Page" + } + ]; + + // The language to retrieve the page for. The following fields are language + // dependent: + // + // * `Page.entry_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * + // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; +} + +// The request message for [Pages.CreatePage][google.cloud.dialogflow.cx.v3beta1.Pages.CreatePage]. +message CreatePageRequest { + // Required. The flow to create a page for. + // Format: `projects//locations//agents//flows/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Page" + } + ]; + + // Required. The page to create. + Page page = 2 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `page`: + // + // * `Page.entry_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * + // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [Pages.UpdatePage][google.cloud.dialogflow.cx.v3beta1.Pages.UpdatePage]. +message UpdatePageRequest { + // Required. The page to update. + Page page = 1 [(google.api.field_behavior) = REQUIRED]; + + // The language of the following fields in `page`: + // + // * `Page.entry_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + // * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + // * `Page.transition_routes.trigger_fulfillment.messages` + // * + // `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; + + // The mask to control which fields get updated. If the mask is not present, + // all fields will be updated. + google.protobuf.FieldMask update_mask = 3; +} + +// The request message for [Pages.DeletePage][google.cloud.dialogflow.cx.v3beta1.Pages.DeletePage]. +message DeletePageRequest { + // Required. The name of the page to delete. + // Format: `projects//locations//agents//Flows//pages/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Page" + } + ]; + + // This field has no effect for pages with no incoming transitions. + // For pages with incoming transitions: + // + // * If `force` is set to false, an error will be returned with message + // indicating the incoming transitions. + // * If `force` is set to true, Dialogflow will remove the page, as well as + // any transitions to the page (i.e. [Target + // page][EventHandler.target_page] in event handlers or [Target + // page][TransitionRoute.target_page] in transition routes that point to + // this page will be cleared). + bool force = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto b/protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto new file mode 100644 index 00000000..7a9f9650 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto @@ -0,0 +1,205 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.cx.v3beta1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "ResponseMessageProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Represents a response message that can be returned by a conversational agent. +// +// Response messages are also used for output audio synthesis. The approach is +// as follows: +// +// * If at least one OutputAudioText response is present, then all +// OutputAudioText responses are linearly concatenated, and the result is used +// for output audio synthesis. +// * If the OutputAudioText responses are a mixture of text and SSML, then the +// concatenated result is treated as SSML; otherwise, the result is treated as +// either text or SSML as appropriate. The agent designer should ideally use +// either text or SSML consistently throughout the bot design. +// * Otherwise, all Text responses are linearly concatenated, and the result is +// used for output audio synthesis. +// +// This approach allows for more sophisticated user experience scenarios, where +// the text displayed to the user may differ from what is heard. +message ResponseMessage { + // The text response message. + message Text { + // Required. A collection of text responses. + repeated string text = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Whether the playback of this message can be interrupted by the end + // user's speech and the client can then starts the next Dialogflow + // request. + bool allow_playback_interruption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Indicates that the conversation should be handed off to a live agent. + // + // Dialogflow only uses this to determine which conversations were handed off + // to a human agent for measurement purposes. What else to do with this signal + // is up to you and your handoff procedures. + // + // You may set this, for example: + // * In the [entry_fulfillment][google.cloud.dialogflow.cx.v3beta1.Page.entry_fulfillment] of a [Page][google.cloud.dialogflow.cx.v3beta1.Page] if + // entering the page indicates something went extremely wrong in the + // conversation. + // * In a webhook response when you determine that the customer issue can only + // be handled by a human. + message LiveAgentHandoff { + // Custom metadata for your handoff procedure. Dialogflow doesn't impose + // any structure on this. + google.protobuf.Struct metadata = 1; + } + + // Indicates that the conversation succeeded, i.e., the bot handled the issue + // that the customer talked to it about. + // + // Dialogflow only uses this to determine which conversations should be + // counted as successful and doesn't process the metadata in this message in + // any way. Note that Dialogflow also considers conversations that get to the + // conversation end page as successful even if they don't return + // [ConversationSuccess][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess]. + // + // You may set this, for example: + // * In the [entry_fulfillment][google.cloud.dialogflow.cx.v3beta1.Page.entry_fulfillment] of a [Page][google.cloud.dialogflow.cx.v3beta1.Page] if + // entering the page indicates that the conversation succeeded. + // * In a webhook response when you determine that you handled the customer + // issue. + message ConversationSuccess { + // Custom metadata. Dialogflow doesn't impose any structure on this. + google.protobuf.Struct metadata = 1; + } + + // A text or ssml response that is preferentially used for TTS output audio + // synthesis, as described in the comment on the ResponseMessage message. + message OutputAudioText { + // The source, which is either plain text or SSML. + oneof source { + // The raw text to be synthesized. + string text = 1; + + // The SSML text to be synthesized. For more information, see + // [SSML](/speech/text-to-speech/docs/ssml). + string ssml = 2; + } + + // Output only. Whether the playback of this message can be interrupted by the end + // user's speech and the client can then starts the next Dialogflow + // request. + bool allow_playback_interruption = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Represents an audio message that is composed of both segments + // synthesized from the Dialogflow agent prompts and ones hosted externally + // at the specified URIs. + // The external URIs are specified via + // [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio]. + // This message is generated by Dialogflow only and not supposed to be + // defined by the user. + message MixedAudio { + // Represents one segment of audio. + message Segment { + // Content of the segment. + oneof content { + // Raw audio synthesized from the Dialogflow agent's response using + // the output config specified in the request. + bytes audio = 1; + + // Client-specific URI that points to an audio clip accessible to the + // client. Dialogflow does not impose any validation on it. + string uri = 2; + } + + // Output only. Whether the playback of this segment can be interrupted by the end + // user's speech and the client should then start the next Dialogflow + // request. + bool allow_playback_interruption = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Segments this audio response is composed of. + repeated Segment segments = 1; + } + + // Indicates that interaction with the Dialogflow agent has ended. + // This message is generated by Dialogflow only and not supposed to be + // defined by the user. + message EndInteraction { + + } + + // Specifies an audio clip to be played by the client as part of the response. + message PlayAudio { + // Required. URI of the audio clip. Dialogflow does not impose any validation on this + // value. It is specific to the client that reads it. + string audio_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Whether the playback of this message can be interrupted by the end + // user's speech and the client can then starts the next Dialogflow + // request. + bool allow_playback_interruption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Required. The rich response message. + oneof message { + // Returns a text response. + Text text = 1; + + // Returns a response containing a custom, platform-specific payload. + google.protobuf.Struct payload = 2; + + // Indicates that the conversation succeeded. + ConversationSuccess conversation_success = 9; + + // A text or ssml response that is preferentially used for TTS output audio + // synthesis, as described in the comment on the ResponseMessage message. + OutputAudioText output_audio_text = 8; + + // Hands off conversation to a human agent. + LiveAgentHandoff live_agent_handoff = 10; + + // Output only. A signal that indicates the interaction with the Dialogflow agent has + // ended. + // This message is generated by Dialogflow only when the conversation + // reaches `END_SESSION` or `END_PAGE` page. It is not supposed to be + // defined by the user. + // It's guaranteed that there is at most one such message in each response. + EndInteraction end_interaction = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Signal that the client should play an audio clip hosted at a + // client-specific URI. Dialogflow uses this to construct + // [mixed_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.mixed_audio]. However, Dialogflow itself + // does not try to read or process the URI in any way. + PlayAudio play_audio = 12; + + // Output only. An audio response message composed of both the synthesized Dialogflow + // agent responses and responses defined via + // [play_audio][google.cloud.dialogflow.cx.v3beta1.ResponseMessage.play_audio]. + // This message is generated by Dialogflow only and not supposed to be + // defined by the user. + MixedAudio mixed_audio = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/session.proto b/protos/google/cloud/dialogflow/cx/v3beta1/session.proto new file mode 100644 index 00000000..9b94a19d --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/session.proto @@ -0,0 +1,735 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.cx.v3beta1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/cx/v3beta1/audio_config.proto"; +import "google/cloud/dialogflow/cx/v3beta1/flow.proto"; +import "google/cloud/dialogflow/cx/v3beta1/intent.proto"; +import "google/cloud/dialogflow/cx/v3beta1/page.proto"; +import "google/cloud/dialogflow/cx/v3beta1/response_message.proto"; +import "google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto"; +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"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "SessionProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/Session" + pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}" +}; + +// 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. +service Sessions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Processes a natural language query and returns structured, actionable data + // as a result. This method is not idempotent, because it may cause session + // entity types to be updated, which in turn might affect results of future + // queries. + rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { + option (google.api.http) = { + post: "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent" + body: "*" + additional_bindings { + post: "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:detectIntent" + body: "*" + } + }; + } + + // Processes a natural language query in audio format in a streaming fashion + // and returns structured, actionable data as a result. This method is only + // available via the gRPC API (not REST). + rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { + } + + // Returns preliminary intent match results, doesn't change the session + // status. + rpc MatchIntent(MatchIntentRequest) returns (MatchIntentResponse) { + option (google.api.http) = { + post: "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:matchIntent" + body: "*" + additional_bindings { + post: "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:matchIntent" + body: "*" + } + }; + } + + // 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" + body: "*" + additional_bindings { + post: "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/environments/*/sessions/*}:fulfillIntent" + body: "*" + } + }; + } +} + +// The request to detect user's intent. +message DetectIntentRequest { + // Required. The name of the session this query is sent to. + // Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. + // It's up to the API caller to choose an appropriate `Session ID`. It can be + // a random number or some type of session identifiers (preferably hashed). + // The length of the `Session ID` must not exceed 36 characters. + // + // For more information, see the [sessions + // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Instructs the speech synthesizer how to generate the output audio. + OutputAudioConfig output_audio_config = 4; +} + +// The message returned from the DetectIntent method. +message DetectIntentResponse { + // Output only. The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The result of the conversational query. + QueryResult query_result = 2; + + // 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 + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 4; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 5; +} + +// The top-level message sent by the client to the +// [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 +// [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]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio duration so far. +// * Dialogflow discards all Speech recognition results in favor of the +// input text. +// * Dialogflow will use the language code from the first message. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingDetectIntentRequest { + // The name of the session this query is sent to. + // Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. + // It's up to the API caller to choose an appropriate `Session ID`. It can be + // a random number or some type of session identifiers (preferably hashed). + // The length of the `Session ID` must not exceed 36 characters. + // Note: session must be set in the first request. + // + // For more information, see the [sessions + // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + string session = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + }]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Instructs the speech synthesizer how to generate the output audio. + OutputAudioConfig output_audio_config = 4; +} + +// The top-level message returned from the `StreamingDetectIntent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the input was set to streaming audio, the first one or more messages +// contain `recognition_result`. Each `recognition_result` represents a more +// complete transcript of what the user said. The last `recognition_result` +// has `is_final` set to `true`. +// +// 2. The last message contains `detect_intent_response`. +message StreamingDetectIntentResponse { + // The output response. + oneof response { + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 1; + + // The response from detect intent. + DetectIntentResponse detect_intent_response = 2; + } +} + +// Contains a speech recognition result corresponding to a portion of the audio +// that is currently being processed or an indication that this is the end +// of the single requested utterance. +// +// Example: +// +// 1. transcript: "tube" +// +// 2. transcript: "to be a" +// +// 3. transcript: "to be" +// +// 4. transcript: "to be or not to be" +// is_final: true +// +// 5. transcript: " that's" +// +// 6. transcript: " that is" +// +// 7. message_type: `END_OF_SINGLE_UTTERANCE` +// +// 8. transcript: " that is the question" +// is_final: true +// +// Only two of the responses contain final results (#4 and #8 indicated by +// `is_final: true`). Concatenating these generates the full transcript: "to be +// or not to be that is the question". +// +// In each response we populate: +// +// * for `TRANSCRIPT`: `transcript` and possibly `is_final`. +// +// * for `END_OF_SINGLE_UTTERANCE`: only `message_type`. +message StreamingRecognitionResult { + // Type of the response message. + enum MessageType { + // Not specified. Should never be used. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // Message contains a (possibly partial) transcript. + TRANSCRIPT = 1; + + // Event indicates that the server has detected the end of the user's speech + // utterance and expects no additional speech. Therefore, the server will + // not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. This message is only sent if + // [`single_utterance`][google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.single_utterance] was set to + // `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 2; + } + + // Type of the result message. + MessageType message_type = 1; + + // Transcript text representing the words that the user spoke. + // Populated if and only if `message_type` = `TRANSCRIPT`. + string transcript = 2; + + // If `false`, the `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, the recognizer will not return + // any further hypotheses about this piece of the audio. May only be populated + // for `message_type` = `TRANSCRIPT`. + bool is_final = 3; + + // The Speech confidence between 0.0 and 1.0 for the current portion of audio. + // A higher number indicates an estimated greater likelihood that the + // recognized words are correct. The default of 0.0 is a sentinel value + // indicating that confidence was not set. + // + // This field is typically only provided if `is_final` is true and you should + // not rely on it being accurate or even set. + float confidence = 4; + + // An estimate of the likelihood that the speech recognizer will + // not change its guess about this interim recognition result: + // * If the value is unspecified or 0.0, Dialogflow didn't compute the + // stability. In particular, Dialogflow will only provide stability for + // `TRANSCRIPT` results with `is_final = false`. + // * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely + // unstable and 1.0 means completely stable. + float stability = 6; + + // Word-specific information for the words recognized by Speech in + // [transcript][google.cloud.dialogflow.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; + + // Time offset of the end of this Speech recognition result relative to the + // beginning of the audio. Only populated for `message_type` = + // `TRANSCRIPT`. + google.protobuf.Duration speech_end_offset = 8; +} + +// Represents the parameters of a conversational query. +message QueryParameters { + // The time zone of this conversational query from the [time zone + // database](https://www.iana.org/time-zones), e.g., America/New_York, + // Europe/Paris. If not provided, the time zone specified in the agent is + // used. + string time_zone = 1; + + // The geo location of this conversational query. + google.type.LatLng geo_location = 2; + + // Additional session entity types to replace or extend developer entity types + // with. The entity synonyms apply to all languages and persist for the + // session of this query. + repeated SessionEntityType session_entity_types = 3; + + // This field can be used to pass custom data into the webhook associated with + // the agent. Arbitrary JSON objects are supported. + google.protobuf.Struct payload = 4; + + // Additional parameters to be put into [session + // parameters][SessionInfo.parameters]. To remove a + // parameter from the session, clients should explicitly set the parameter + // value to null. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: string or number, depending on parameter value type + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 5; + + // Configures whether sentiment analysis should be performed. If not + // provided, sentiment analysis is not performed. + bool analyze_query_text_sentiment = 8; +} + +// Represents the query input. It can contain one of: +// +// 1. A conversational query in the form of text. +// +// 2. An intent query that specifies which intent to trigger. +// +// 3. Natural language speech audio to be processed. +// +// 4. An event to be triggered. +// +message QueryInput { + // Required. The input specification. + oneof input { + // The natural language text to be processed. + TextInput text = 2; + + // The intent to be triggered. + IntentInput intent = 3; + + // The natural language speech audio to be processed. + AudioInput audio = 5; + + // The event to be triggered. + EventInput event = 6; + + // The DTMF event to be handled. + DtmfInput dtmf = 7; + } + + // Required. The language of the input. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) for a + // list of the currently supported language codes. Note that queries in the + // same session do not necessarily need to specify the same language. + string language_code = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the result of a conversational query. +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. + 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. + string trigger_intent = 11; + + // If [natural language speech audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as input, + // this field will contain the trascript 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. + string trigger_event = 14; + } + + // The language that was triggered during intent detection. + // See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 2; + + // 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 + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: string or number, depending on parameter value type + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 3; + + // The list of rich messages returned to the client. Responses vary from + // simple text messages to more sophisticated, structured payloads used + // to drive complex logic. + repeated ResponseMessage response_messages = 4; + + // 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 + // 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`. + 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. + Intent intent = 8 [deprecated = true]; + + // The intent detection confidence. Values range from 0.0 (completely + // uncertain) to 1.0 (completely certain). + // This value is for informational purpose only and is only used to + // help match the best intent within the classification threshold. + // This value may change for the same end-user expression at any time due to a + // model retraining or change in implementation. + // 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. + Match match = 15; + + // The free-form diagnostic info. For example, this field could contain + // webhook call latency. The string keys of the Struct's fields map can change + // without notice. + google.protobuf.Struct diagnostic_info = 10; + + // 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. + 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. + string text = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the intent to trigger programmatically rather than as a result of +// natural language processing. +message IntentInput { + // Required. The unique identifier of the intent. + // Format: `projects//locations//agents//intents/`. + string intent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; +} + +// Represents the natural speech audio to be processed. +message AudioInput { + // Required. Instructs the speech recognizer how to process the speech audio. + InputAudioConfig config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The natural language speech audio to be processed. + // A single request can contain up to 1 minute of speech audio data. + // The [transcribed text][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. + // For streaming audio detect intent, `config` must be provided in + // the first request and `audio` must be provided in all following requests. + bytes audio = 2; +} + +// Represents the event to trigger. +message EventInput { + // Name of the event. + string event = 1; +} + +// Represents the input for dtmf event. +message DtmfInput { + // The dtmf digits. + string digits = 1; + + // The finish digit (if any). + string finish_digit = 2; +} + +// Represents one match result of [MatchIntent][]. +message Match { + // Type of a Match. + enum MatchType { + // Not specified. Should never be used. + MATCH_TYPE_UNSPECIFIED = 0; + + // The query was matched to an intent. + INTENT = 1; + + // The query directly triggered an intent. + DIRECT_INTENT = 2; + + // The query was used for parameter filling. + PARAMETER_FILLING = 3; + + // No match was found for the query. + NO_MATCH = 4; + + // Indicates an empty query. + NO_INPUT = 5; + + // The query directly triggered an event. + 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. + Intent intent = 1; + + // The event that matched the query. Only filled for + // [`EVENT`][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] match type. + string event = 6; + + // The collection of parameters extracted from the query. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: string or number, depending on parameter value type + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 2; + + // Final text input which was matched during MatchIntent. This value can be + // different from original input sent in request because of spelling + // correction or other processing. + string resolved_input = 3; + + // Type of this [Match][google.cloud.dialogflow.cx.v3beta1.Match]. + MatchType match_type = 4; + + // The confidence of this match. Values range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + // This value is for informational purpose only and is only used to help match + // the best intent within the classification threshold. This value may change + // for the same end-user expression at any time due to a model retraining or + // change in implementation. + float confidence = 5; +} + +// Request of [MatchIntent][]. +message MatchIntentRequest { + // Required. The name of the session this query is sent to. + // Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. + // It's up to the API caller to choose an appropriate `Session ID`. It can be + // a random number or some type of session identifiers (preferably hashed). + // The length of the `Session ID` must not exceed 36 characters. + // + // For more information, see the [sessions + // guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response of [MatchIntent][]. +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. + 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. + string trigger_intent = 2; + + // If [natural language speech audio][google.cloud.dialogflow.cx.v3beta1.AudioInput] was provided as input, + // this field will contain the trascript 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. + string trigger_event = 6; + } + + // Match results, if more than one, ordered descendingly by the confidence + // 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`. + Page current_page = 5; +} + +// Request of [FulfillIntent][] +message FulfillIntentRequest { + // Must be same as the corresponding MatchIntent request, otherwise the + // behavior is undefined. + MatchIntentRequest match_intent_request = 1; + + // The matched intent/event to fulfill. + Match match = 2; + + // Instructs the speech synthesizer how to generate output audio. + OutputAudioConfig output_audio_config = 3; +} + +// Response of [FulfillIntent][] +message FulfillIntentResponse { + // Output only. The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The result of the conversational query. + QueryResult query_result = 2; + + // 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 + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 3; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 4; +} + +// The result of sentiment analysis. Sentiment analysis inspects user input +// and identifies the prevailing subjective opinion, especially to determine a +// user's attitude as positive, negative, or neutral. +message SentimentAnalysisResult { + // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + // sentiment). + float score = 1; + + // A non-negative number in the [0, +inf) range, which represents the absolute + // magnitude of sentiment, regardless of score (positive or negative). + float magnitude = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto b/protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto new file mode 100644 index 00000000..5b8f5df9 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto @@ -0,0 +1,264 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/entity_type.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "SessionEntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [SessionEntityTypes][google.cloud.dialogflow.cx.v3beta1.SessionEntityType]. +service SessionEntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all session entity types in the specified session. + rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*/sessions/*}/entityTypes" + additional_bindings { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*/sessions/*}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified session entity type. + rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}" + additional_bindings { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a session entity type. + // + // If the specified session entity type already exists, overrides the + // session entity type. + rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*/sessions/*}/entityTypes" + body: "session_entity_type" + additional_bindings { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "parent,session_entity_type"; + } + + // Updates the specified session entity type. + rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + patch: "/v3beta1/{session_entity_type.name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + additional_bindings { + patch: "/v3beta1/{session_entity_type.name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "session_entity_type,update_mask"; + } + + // Deletes the specified session entity type. + rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}" + additional_bindings { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// Session entity types are referred to as **User** entity types and are +// entities that are built for an individual user such as favorites, +// preferences, playlists, and so on. +// +// You can redefine a session entity type at the session level to extend or +// replace a [custom entity type][google.cloud.dialogflow.cx.v3beta1.EntityType] at the user session level (we +// refer to the entity types defined at the agent level as "custom entity +// types"). +// +// Note: session entity types apply to all queries, regardless of the language. +// +// For more information about entity types, see the [Dialogflow +// documentation](https://cloud.google.com/dialogflow/docs/entities-overview). +message SessionEntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/SessionEntityType" + pattern: "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}" + }; + + // The types of modifications for the session entity type. + enum EntityOverrideMode { + // Not specified. This value should be never used. + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; + + // The collection of session entities overrides the collection of entities + // in the corresponding custom entity type. + ENTITY_OVERRIDE_MODE_OVERRIDE = 1; + + // The collection of session entities extends the collection of entities in + // the corresponding custom entity type. + // + // Note: Even in this override mode calls to `ListSessionEntityTypes`, + // `GetSessionEntityType`, `CreateSessionEntityType` and + // `UpdateSessionEntityType` only return the additional entities added in + // this session entity type. If you want to get the supplemented list, + // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.cx.v3beta1.EntityTypes.GetEntityType] on the custom entity type + // and merge. + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; + } + + // Required. The unique identifier of the session entity type. + // Format: `projects//locations//agents//sessions//entityTypes/` or `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + // environment. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates whether the additional data should override or supplement the + // custom entity type definition. + EntityOverrideMode entity_override_mode = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The collection of entities to override or supplement the custom entity + // type. + repeated EntityType.Entity entities = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesRequest { + // Required. The session to list all session entity types from. + // Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesResponse { + // The list of session entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated SessionEntityType session_entity_types = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.GetSessionEntityType]. +message GetSessionEntityTypeRequest { + // Required. The name of the session entity type. + // Format: `projects//locations//agents//sessions//entityTypes/` or + // `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + // environment. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} + +// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.CreateSessionEntityType]. +message CreateSessionEntityTypeRequest { + // Required. The session to create a session entity type for. + // Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Required. The session entity type to create. + SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.UpdateSessionEntityType]. +message UpdateSessionEntityTypeRequest { + // Required. The session entity type to update. + // Format: `projects//locations//agents//sessions//entityTypes/` or + // `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + // environment. + SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.DeleteSessionEntityType]. +message DeleteSessionEntityTypeRequest { + // Required. The name of the session entity type to delete. + // Format: `projects//locations//agents//sessions//entityTypes/` or + // `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + // environment. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto b/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto new file mode 100644 index 00000000..a2eed7b4 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto @@ -0,0 +1,248 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/page.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "TransitionRouteGroupProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [TransitionRouteGroups][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. +service TransitionRouteGroups { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all transition route groups in the specified flow. + rpc ListTransitionRouteGroups(ListTransitionRouteGroupsRequest) returns (ListTransitionRouteGroupsResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. + rpc GetTransitionRouteGroup(GetTransitionRouteGroupRequest) returns (TransitionRouteGroup) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] in the specified flow. + rpc CreateTransitionRouteGroup(CreateTransitionRouteGroupRequest) returns (TransitionRouteGroup) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups" + body: "transition_route_group" + }; + option (google.api.method_signature) = "parent,transition_route_group"; + } + + // Updates the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. + rpc UpdateTransitionRouteGroup(UpdateTransitionRouteGroupRequest) returns (TransitionRouteGroup) { + option (google.api.http) = { + patch: "/v3beta1/{transition_route_group.name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}" + body: "transition_route_group" + }; + option (google.api.method_signature) = "transition_route_group,update_mask"; + } + + // Deletes the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. + rpc DeleteTransitionRouteGroup(DeleteTransitionRouteGroupRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// An TransitionRouteGroup represents a group of +// [`TransitionRoutes`][google.cloud.dialogflow.cx.v3beta1.TransitionRoute] to be used by a [Page][google.cloud.dialogflow.cx.v3beta1.Page]. +message TransitionRouteGroup { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/TransitionRouteGroup" + pattern: "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}" + }; + + // The unique identifier of the transition route group. + // [TransitionRouteGroups.CreateTransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.CreateTransitionRouteGroup] populates the name + // automatically. + // Format: `projects//locations//agents//flows//transitionRouteGroups/`. + string name = 1; + + // Required. The human-readable name of the transition route group, unique within + // the [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. The display name can be no longer than 30 characters. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Transition routes associated with the [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. + // Duplicate transition routes (i.e. using the same + // [`intent`][google.cloud.dialogflow.cx.v3beta1.TransitionRoute.intent]) are not allowed. + // + // Note that the [`name`][google.cloud.dialogflow.cx.v3beta1.TransitionRoute.name] field is not used in the + // transition route group scope. + repeated TransitionRoute transition_routes = 5; +} + +// The request message for [TransitionRouteGroups.ListTransitionRouteGroups][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.ListTransitionRouteGroups]. +message ListTransitionRouteGroupsRequest { + // Required. The flow to list all transition route groups for. + // Format: `projects//locations//agents//flows/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/TransitionRouteGroup" + } + ]; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The 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. + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 4; +} + +// The response message for [TransitionRouteGroups.ListTransitionRouteGroups][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.ListTransitionRouteGroups]. +message ListTransitionRouteGroupsResponse { + // The list of transition route groups. There will be a maximum number of + // items returned based on the page_size field in the request. The list may in + // some cases be empty or contain fewer entries than page_size even if this + // isn't the last page. + repeated TransitionRouteGroup transition_route_groups = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [TransitionRouteGroups.GetTransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.GetTransitionRouteGroup]. +message GetTransitionRouteGroupRequest { + // Required. The name of the [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. + // Format: `projects//locations//agents//flows//transitionRouteGroups/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/TransitionRouteGroup" + } + ]; + + // 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. + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 2; +} + +// The request message for [TransitionRouteGroups.CreateTransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.CreateTransitionRouteGroup]. +message CreateTransitionRouteGroupRequest { + // Required. The flow to create an [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] for. + // Format: `projects//locations//agents//flows/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/TransitionRouteGroup" + } + ]; + + // 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. + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [TransitionRouteGroups.UpdateTransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.UpdateTransitionRouteGroup]. +message UpdateTransitionRouteGroupRequest { + // Required. The transition route group to update. + TransitionRouteGroup transition_route_group = 1 [(google.api.field_behavior) = REQUIRED]; + + // 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. + // + // If not specified, the agent's default language is used. + // [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. + // Note: languages must be enabled in the agent before they can be used. + string language_code = 3; +} + +// The request message for [TransitionRouteGroups.DeleteTransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.DeleteTransitionRouteGroup]. +message DeleteTransitionRouteGroupRequest { + // Required. The name of the [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup] to delete. + // Format: `projects//locations//agents//flows//transitionRouteGroups/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/TransitionRouteGroup" + } + ]; + + // This field has no effect for transition route group that no page is using. + // If the transition route group is referenced by any page: + // + // * If `force` is set to false, an error will be returned with message + // indicating pages that reference the transition route group. + // * If `force` is set to true, Dialogflow will remove the transition route + // group, as well as any reference to it. + bool force = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/version.proto b/protos/google/cloud/dialogflow/cx/v3beta1/version.proto new file mode 100644 index 00000000..819a6d3c --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/version.proto @@ -0,0 +1,261 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/flow.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Versions][google.cloud.dialogflow.cx.v3beta1.Version]. +service Versions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a [Version][google.cloud.dialogflow.cx.v3beta1.Version] in the specified [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. + rpc CreateVersion(CreateVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/versions" + body: "version" + }; + option (google.api.method_signature) = "parent,version"; + option (google.longrunning.operation_info) = { + response_type: "Version" + metadata_type: "CreateVersionOperationMetadata" + }; + } + + // Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. + rpc UpdateVersion(UpdateVersionRequest) returns (Version) { + option (google.api.http) = { + patch: "/v3beta1/{version.name=projects/*/locations/*/agents/*/flows/*/versions/*}" + body: "version" + }; + option (google.api.method_signature) = "version,update_mask"; + } + + // Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. + rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Loads a specified version to draft version. + rpc LoadVersion(LoadVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}:load" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Metadata associated with the long running operation for +// [Versions.CreateVersion][google.cloud.dialogflow.cx.v3beta1.Versions.CreateVersion]. +message CreateVersionOperationMetadata { + // Name of the created version. + // Format: `projects//locations//agents//flows//versions/`. + string version = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + }]; +} + +// Represents a version of a flow. +message Version { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Version" + pattern: "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}" + }; + + // The state of the version. + enum State { + // Not specified. This value is not used. + STATE_UNSPECIFIED = 0; + + // Version is not ready to serve (e.g. training is running). + RUNNING = 1; + + // Training has succeeded and this version is ready to serve. + SUCCEEDED = 2; + + // Version training failed. + FAILED = 3; + } + + // Format: projects//locations//agents//flows//versions/. Version ID is a self-increasing + // number generated by Dialogflow upon version creation. + string name = 1; + + // Required. The human-readable name of the version. Limit of 64 characters. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The description of the version. The maximum length is 500 characters. If + // exceeded, the request is rejected. + string description = 3; + + // Output only. The NLU settings of the flow at version creation. + NluSettings nlu_settings = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Create time of the version. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of this version. This field is read-only and cannot be set by + // create and update methods. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Versions.ListVersions][google.cloud.dialogflow.cx.v3beta1.Versions.ListVersions]. +message ListVersionsRequest { + // Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to list all versions for. + // Format: `projects//locations//agents//flows/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // The maximum number of items to return in a single page. By default 20 and + // at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Versions.ListVersions][google.cloud.dialogflow.cx.v3beta1.Versions.ListVersions]. +message ListVersionsResponse { + // A list of versions. There will be a maximum number of items returned based + // on the page_size field in the request. The list may in some cases be empty + // or contain fewer entries than page_size even if this isn't the last page. + repeated Version versions = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [Versions.GetVersion][google.cloud.dialogflow.cx.v3beta1.Versions.GetVersion]. +message GetVersionRequest { + // Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version]. + // Format: `projects//locations//agents//flows//versions/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} + +// The request message for [Versions.CreateVersion][google.cloud.dialogflow.cx.v3beta1.Versions.CreateVersion]. +message CreateVersionRequest { + // Required. The [Flow][google.cloud.dialogflow.cx.v3beta1.Flow] to create an [Version][google.cloud.dialogflow.cx.v3beta1.Version] for. + // Format: `projects//locations//agents//flows/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Required. The version to create. + Version version = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.cx.v3beta1.Versions.UpdateVersion]. +message UpdateVersionRequest { + // Required. The version to update. + Version version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. Currently only `description` + // and `display_name` can be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.cx.v3beta1.Versions.DeleteVersion]. +message DeleteVersionRequest { + // Required. The name of the [Version][google.cloud.dialogflow.cx.v3beta1.Version] to delete. + // Format: `projects//locations//agents//flows//versions/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} + +// 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. + // Format: `projects//locations//agents//flows//versions/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + + // 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). + bool allow_override_agent_resources = 2; +} diff --git a/protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto b/protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto new file mode 100644 index 00000000..e813bf30 --- /dev/null +++ b/protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto @@ -0,0 +1,441 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.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/response_message.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx"; +option java_multiple_files = true; +option java_outer_classname = "WebhookProto"; +option java_package = "com.google.cloud.dialogflow.cx.v3beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Webhooks][google.cloud.dialogflow.cx.v3beta1.Webhook]. +service Webhooks { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all webhooks in the specified agent. + rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) { + option (google.api.http) = { + get: "/v3beta1/{parent=projects/*/locations/*/agents/*}/webhooks" + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified webhook. + rpc GetWebhook(GetWebhookRequest) returns (Webhook) { + option (google.api.http) = { + get: "/v3beta1/{name=projects/*/locations/*/agents/*/webhooks/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a webhook in the specified agent. + rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) { + option (google.api.http) = { + post: "/v3beta1/{parent=projects/*/locations/*/agents/*}/webhooks" + body: "webhook" + }; + option (google.api.method_signature) = "parent,webhook"; + } + + // Updates the specified webhook. + rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) { + option (google.api.http) = { + patch: "/v3beta1/{webhook.name=projects/*/locations/*/agents/*/webhooks/*}" + body: "webhook" + }; + option (google.api.method_signature) = "webhook,update_mask"; + } + + // Deletes the specified webhook. + rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3beta1/{name=projects/*/locations/*/agents/*/webhooks/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Webhooks host the developer's business logic. During a session, webhooks +// allow the developer to use the data extracted by Dialogflow's natural +// language processing to generate dynamic responses, validate collected data, +// or trigger actions on the backend. +message Webhook { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Webhook" + pattern: "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}" + }; + + // Represents configuration for a generic web service. + message GenericWebService { + // Required. The webhook URI for receiving POST requests. It must use https protocol. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // The user name for HTTP Basic authentication. + string username = 2 [deprecated = true]; + + // The password for HTTP Basic authentication. + string password = 3 [deprecated = true]; + + // The HTTP request headers to send together with webhook + // requests. + map request_headers = 4; + } + + // The unique identifier of the webhook. + // Required for the [Webhooks.UpdateWebhook][google.cloud.dialogflow.cx.v3beta1.Webhooks.UpdateWebhook] method. + // [Webhooks.CreateWebhook][google.cloud.dialogflow.cx.v3beta1.Webhooks.CreateWebhook] populates the name automatically. + // Format: `projects//locations//agents//webhooks/`. + string name = 1; + + // Required. The human-readable name of the webhook, unique within the agent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The webhook configuration. + oneof webhook { + // Configuration for a generic web service. + GenericWebService generic_web_service = 4; + } + + // Webhook execution timeout. Execution is considered failed if Dialogflow + // doesn't receive a response from webhook at the end of the timeout period. + // Defaults to 5 seconds, maximum allowed timeout is 30 seconds. + google.protobuf.Duration timeout = 6; + + // Indicates whether the webhook is disabled. + bool disabled = 5; +} + +// The request message for [Webhooks.ListWebhooks][google.cloud.dialogflow.cx.v3beta1.Webhooks.ListWebhooks]. +message ListWebhooksRequest { + // Required. The agent to list all webhooks for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Webhook" + } + ]; + + // The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Webhooks.ListWebhooks][google.cloud.dialogflow.cx.v3beta1.Webhooks.ListWebhooks]. +message ListWebhooksResponse { + // The list of webhooks. There will be a maximum number of items returned + // based on the page_size field in the request. + repeated Webhook webhooks = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results in the list. + string next_page_token = 2; +} + +// The request message for [Webhooks.GetWebhook][google.cloud.dialogflow.cx.v3beta1.Webhooks.GetWebhook]. +message GetWebhookRequest { + // Required. The name of the webhook. + // Format: `projects//locations//agents//webhooks/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Webhook" + } + ]; +} + +// The request message for [Webhooks.CreateWebhook][google.cloud.dialogflow.cx.v3beta1.Webhooks.CreateWebhook]. +message CreateWebhookRequest { + // Required. The agent to create a webhook for. + // Format: `projects//locations//agents/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Webhook" + } + ]; + + // Required. The webhook to create. + Webhook webhook = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Webhooks.UpdateWebhook][google.cloud.dialogflow.cx.v3beta1.Webhooks.UpdateWebhook]. +message UpdateWebhookRequest { + // Required. The webhook to update. + Webhook webhook = 1 [(google.api.field_behavior) = REQUIRED]; + + // The mask to control which fields get updated. If the mask is not present, + // all fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [Webhooks.DeleteWebhook][google.cloud.dialogflow.cx.v3beta1.Webhooks.DeleteWebhook]. +message DeleteWebhookRequest { + // Required. The name of the webhook to delete. + // Format: `projects//locations//agents//webhooks/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Webhook" + } + ]; + + // This field has no effect for webhook not being used. + // For webhooks that are used by pages/flows/transition route groups: + // + // * If `force` is set to false, an error will be returned with message + // indicating the referenced resources. + // * If `force` is set to true, Dialogflow will remove the webhook, as well + // as any references to the webhook (i.e. [Webhook][google.cloud.dialogflow.cx.v3beta1.Fulfillment.webhook] + // and [tag][google.cloud.dialogflow.cx.v3beta1.Fulfillment.tag]in fulfillments that point to this webhook + // will be removed). + bool force = 2; +} + +// The request message for a webhook call. +message WebhookRequest { + // Represents fulfillment information communicated to the webhook. + message FulfillmentInfo { + // Always present. The tag used to identify which fulfillment is being + // called. + string tag = 1; + } + + // Represents intent information communicated to the webhook. + message IntentInfo { + // Represents a value for an intent parameter. + message IntentParameterValue { + // Always present. Original text value extracted from user utterance. + string original_value = 1; + + // Always present. Structured value for the parameter extracted from user + // utterance. + google.protobuf.Value resolved_value = 2; + } + + // Always present. The unique identifier of the last matched + // [intent][google.cloud.dialogflow.cx.v3beta1.Intent]. Format: `projects//locations//agents//intents/`. + string last_matched_intent = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + }]; + + // Parameters identified as a result of intent matching. This is a map of + // the name of the identified parameter to the value of the parameter + // identified from the user's utterance. All parameters defined in the + // matched intent that are identified will be surfaced here. + map parameters = 2; + } + + // Always present. The unique identifier of the [DetectIntentResponse][google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse] that + // will be returned to the API caller. + string detect_intent_response_id = 1; + + // Always present. Information about the fulfillment that triggered this + // webhook call. + FulfillmentInfo fulfillment_info = 6; + + // Information about the last matched intent. + IntentInfo intent_info = 3; + + // Information about page status. + PageInfo page_info = 4; + + // Information about session status. + SessionInfo session_info = 5; + + // The list of rich message responses to present to the user. Webhook can + // choose to append or replace this list in + // [WebhookResponse.fulfillment_response][google.cloud.dialogflow.cx.v3beta1.WebhookResponse.fulfillment_response]; + repeated ResponseMessage messages = 7; + + // Custom data set in [QueryParameters.payload][google.cloud.dialogflow.cx.v3beta1.QueryParameters.payload]. + google.protobuf.Struct payload = 8; +} + +// The response message for a webhook call. +message WebhookResponse { + // Represents a fulfillment response to the user. + message FulfillmentResponse { + // Defines merge behavior for `messages`. + enum MergeBehavior { + // Not specified. `APPEND` will be used. + MERGE_BEHAVIOR_UNSPECIFIED = 0; + + // `messages` will be appended to the list of messages waiting to be sent + // to the user. + APPEND = 1; + + // `messages` will replace the list of messages waiting to be sent to the + // user. + REPLACE = 2; + } + + // The list of rich message responses to present to the user. + repeated ResponseMessage messages = 1; + + // Merge behavior for `messages`. + MergeBehavior merge_behavior = 2; + } + + // The fulfillment response to send to the user. This field can be omitted by + // the webhook if it does not intend to send any response to the user. + FulfillmentResponse fulfillment_response = 1; + + // Information about page status. This field can be omitted by the webhook if + // it does not intend to modify page status. + PageInfo page_info = 2; + + // Information about session status. This field can be omitted by the webhook + // if it does not intend to modify session status. + SessionInfo session_info = 3; + + // Value to append directly to [QueryResult.webhook_payloads][google.cloud.dialogflow.cx.v3beta1.QueryResult.webhook_payloads]. + google.protobuf.Struct payload = 4; + + // The target to transition to. This can be set optionally to indicate an + // immediate transition to a different page in the same host flow, or a + // different flow in the same agent. + oneof transition { + // The target page to transition to. + // Format: `projects//locations//agents//flows//pages/`. + string target_page = 5 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Page" + }]; + + // The target flow to transition to. + // Format: `projects//locations//agents//flows/`. + string target_flow = 6 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Flow" + }]; + } +} + +// Represents page information communicated to and from the webhook. +message PageInfo { + // Represents form information. + message FormInfo { + // Represents parameter information. + message ParameterInfo { + // Represents the state of a parameter. + enum ParameterState { + // Not specified. This value should be never used. + PARAMETER_STATE_UNSPECIFIED = 0; + + // Indicates that the parameter does not have a value. + EMPTY = 1; + + // Indicates that the parameter value is invalid. This field can be used + // by the webhook to invalidate the parameter and ask the server to + // collect it from the user again. + INVALID = 2; + + // Indicates that the parameter has a value. + FILLED = 3; + } + + // Always present for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Required for + // [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // The human-readable name of the parameter, unique within the form. This + // field cannot be modified by the webhook. + string display_name = 1; + + // Optional for both [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // Indicates whether the parameter is required. Optional parameters will + // not trigger prompts; however, they are filled if the user specifies + // them. Required parameters must be filled before form filling concludes. + bool required = 2; + + // Always present for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Required for + // [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. The state of the parameter. This field can be set + // to [INVALID][google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState.INVALID] by + // the webhook to invalidate the parameter; other values set by the + // webhook will be ignored. + ParameterState state = 3; + + // Optional for both [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // The value of the parameter. This field can be set by the webhook to + // change the parameter value. + google.protobuf.Value value = 4; + + // Optional for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Ignored for [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // Indicates if the parameter value was just collected on the last + // conversation turn. + bool just_collected = 5; + } + + // Optional for both [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // The parameters contained in the form. Note that the webhook cannot add + // or remove any form parameter. + repeated ParameterInfo parameter_info = 2; + } + + // Always present for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Ignored for [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // The unique identifier of the current page. + // Format: `projects//locations//agents//flows//pages/`. + string current_page = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Page" + }]; + + // Optional for both [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // Information about the form. + FormInfo form_info = 3; +} + +// Represents session information communicated to and from the webhook. +message SessionInfo { + // Always present for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Ignored for [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // The unique identifier of the [session][google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.session]. This + // field can be used by the webhook to identify a user. + // Format: `projects//locations//agents//sessions/`. + string session = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + }]; + + // Optional for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Optional for [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. + // All parameters collected from forms and intents during the session. + // Parameters can be created, updated, or removed by the webhook. To remove a + // parameter from the session, the webhook should explicitly set the parameter + // value to null in [WebhookResponse][google.cloud.dialogflow.cx.v3beta1.WebhookResponse]. The map is keyed by parameters' + // display names. + map parameters = 2; +} diff --git a/protos/protos.d.ts b/protos/protos.d.ts index e107703d..fe5a16b5 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -16878,6 +16878,16010 @@ export namespace google { public toJSON(): { [k: string]: any }; } } + + /** Namespace v3beta1. */ + namespace v3beta1 { + + /** Represents an Agents */ + class Agents extends $protobuf.rpc.Service { + + /** + * Constructs a new Agents service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Agents service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Agents; + + /** + * Calls ListAgents. + * @param request ListAgentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListAgentsResponse + */ + public listAgents(request: google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.ListAgentsCallback): void; + + /** + * Calls ListAgents. + * @param request ListAgentsRequest message or plain object + * @returns Promise + */ + public listAgents(request: google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest): Promise; + + /** + * Calls GetAgent. + * @param request GetAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public getAgent(request: google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.GetAgentCallback): void; + + /** + * Calls GetAgent. + * @param request GetAgentRequest message or plain object + * @returns Promise + */ + public getAgent(request: google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest): Promise; + + /** + * Calls CreateAgent. + * @param request CreateAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public createAgent(request: google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.CreateAgentCallback): void; + + /** + * Calls CreateAgent. + * @param request CreateAgentRequest message or plain object + * @returns Promise + */ + public createAgent(request: google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest): Promise; + + /** + * Calls UpdateAgent. + * @param request UpdateAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public updateAgent(request: google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgentCallback): void; + + /** + * Calls UpdateAgent. + * @param request UpdateAgentRequest message or plain object + * @returns Promise + */ + public updateAgent(request: google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest): Promise; + + /** + * Calls DeleteAgent. + * @param request DeleteAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteAgent(request: google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.DeleteAgentCallback): void; + + /** + * Calls DeleteAgent. + * @param request DeleteAgentRequest message or plain object + * @returns Promise + */ + public deleteAgent(request: google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest): Promise; + + /** + * Calls ExportAgent. + * @param request ExportAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportAgent(request: google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgentCallback): void; + + /** + * Calls ExportAgent. + * @param request ExportAgentRequest message or plain object + * @returns Promise + */ + public exportAgent(request: google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest): Promise; + + /** + * Calls RestoreAgent. + * @param request RestoreAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restoreAgent(request: google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Agents.RestoreAgentCallback): void; + + /** + * Calls RestoreAgent. + * @param request RestoreAgentRequest message or plain object + * @returns Promise + */ + public restoreAgent(request: google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest): Promise; + } + + namespace Agents { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#listAgents}. + * @param error Error, if any + * @param [response] ListAgentsResponse + */ + type ListAgentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#getAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type GetAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#createAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type CreateAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#updateAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type UpdateAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#deleteAgent}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteAgentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#exportAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#restoreAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type RestoreAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a SpeechToTextSettings. */ + interface ISpeechToTextSettings { + + /** SpeechToTextSettings enableSpeechAdaptation */ + enableSpeechAdaptation?: (boolean|null); + } + + /** Represents a SpeechToTextSettings. */ + class SpeechToTextSettings implements ISpeechToTextSettings { + + /** + * Constructs a new SpeechToTextSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings); + + /** SpeechToTextSettings enableSpeechAdaptation. */ + public enableSpeechAdaptation: boolean; + + /** + * Creates a new SpeechToTextSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechToTextSettings instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings): google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings; + + /** + * Encodes the specified SpeechToTextSettings message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.verify|verify} messages. + * @param message SpeechToTextSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechToTextSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.verify|verify} messages. + * @param message SpeechToTextSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechToTextSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechToTextSettings + * @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.SpeechToTextSettings; + + /** + * Decodes a SpeechToTextSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechToTextSettings + * @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.SpeechToTextSettings; + + /** + * Verifies a SpeechToTextSettings 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 a SpeechToTextSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechToTextSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings; + + /** + * Creates a plain object from a SpeechToTextSettings message. Also converts values to other types if specified. + * @param message SpeechToTextSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechToTextSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an Agent. */ + interface IAgent { + + /** Agent name */ + name?: (string|null); + + /** Agent displayName */ + displayName?: (string|null); + + /** Agent defaultLanguageCode */ + defaultLanguageCode?: (string|null); + + /** Agent timeZone */ + timeZone?: (string|null); + + /** Agent description */ + description?: (string|null); + + /** Agent avatarUri */ + avatarUri?: (string|null); + + /** Agent speechToTextSettings */ + speechToTextSettings?: (google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings|null); + + /** Agent startFlow */ + startFlow?: (string|null); + + /** Agent enableStackdriverLogging */ + enableStackdriverLogging?: (boolean|null); + + /** Agent enableSpellCorrection */ + enableSpellCorrection?: (boolean|null); + } + + /** Represents an Agent. */ + class Agent implements IAgent { + + /** + * Constructs a new Agent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IAgent); + + /** Agent name. */ + public name: string; + + /** Agent displayName. */ + public displayName: string; + + /** Agent defaultLanguageCode. */ + public defaultLanguageCode: string; + + /** Agent timeZone. */ + public timeZone: string; + + /** Agent description. */ + public description: string; + + /** Agent avatarUri. */ + public avatarUri: string; + + /** Agent speechToTextSettings. */ + public speechToTextSettings?: (google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings|null); + + /** Agent startFlow. */ + public startFlow: string; + + /** Agent enableStackdriverLogging. */ + public enableStackdriverLogging: boolean; + + /** Agent enableSpellCorrection. */ + public enableSpellCorrection: boolean; + + /** + * Creates a new Agent instance using the specified properties. + * @param [properties] Properties to set + * @returns Agent instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IAgent): google.cloud.dialogflow.cx.v3beta1.Agent; + + /** + * Encodes the specified Agent message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Agent.verify|verify} messages. + * @param message Agent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Agent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Agent.verify|verify} messages. + * @param message Agent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Agent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Agent + * @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.Agent; + + /** + * Decodes an Agent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Agent + * @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.Agent; + + /** + * Verifies an Agent 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 Agent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Agent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Agent; + + /** + * Creates a plain object from an Agent message. Also converts values to other types if specified. + * @param message Agent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Agent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Agent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListAgentsRequest. */ + interface IListAgentsRequest { + + /** ListAgentsRequest parent */ + parent?: (string|null); + + /** ListAgentsRequest pageSize */ + pageSize?: (number|null); + + /** ListAgentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListAgentsRequest. */ + class ListAgentsRequest implements IListAgentsRequest { + + /** + * Constructs a new ListAgentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest); + + /** ListAgentsRequest parent. */ + public parent: string; + + /** ListAgentsRequest pageSize. */ + public pageSize: number; + + /** ListAgentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListAgentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAgentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest): google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest; + + /** + * Encodes the specified ListAgentsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest.verify|verify} messages. + * @param message ListAgentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAgentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest.verify|verify} messages. + * @param message ListAgentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAgentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAgentsRequest + * @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.ListAgentsRequest; + + /** + * Decodes a ListAgentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAgentsRequest + * @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.ListAgentsRequest; + + /** + * Verifies a ListAgentsRequest 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 a ListAgentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAgentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest; + + /** + * Creates a plain object from a ListAgentsRequest message. Also converts values to other types if specified. + * @param message ListAgentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAgentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListAgentsResponse. */ + interface IListAgentsResponse { + + /** ListAgentsResponse agents */ + agents?: (google.cloud.dialogflow.cx.v3beta1.IAgent[]|null); + + /** ListAgentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListAgentsResponse. */ + class ListAgentsResponse implements IListAgentsResponse { + + /** + * Constructs a new ListAgentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse); + + /** ListAgentsResponse agents. */ + public agents: google.cloud.dialogflow.cx.v3beta1.IAgent[]; + + /** ListAgentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListAgentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAgentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse): google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse; + + /** + * Encodes the specified ListAgentsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse.verify|verify} messages. + * @param message ListAgentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAgentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse.verify|verify} messages. + * @param message ListAgentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAgentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAgentsResponse + * @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.ListAgentsResponse; + + /** + * Decodes a ListAgentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAgentsResponse + * @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.ListAgentsResponse; + + /** + * Verifies a ListAgentsResponse 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 a ListAgentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAgentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse; + + /** + * Creates a plain object from a ListAgentsResponse message. Also converts values to other types if specified. + * @param message ListAgentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAgentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetAgentRequest. */ + interface IGetAgentRequest { + + /** GetAgentRequest name */ + name?: (string|null); + } + + /** Represents a GetAgentRequest. */ + class GetAgentRequest implements IGetAgentRequest { + + /** + * Constructs a new GetAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest); + + /** GetAgentRequest name. */ + public name: string; + + /** + * Creates a new GetAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest): google.cloud.dialogflow.cx.v3beta1.GetAgentRequest; + + /** + * Encodes the specified GetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetAgentRequest.verify|verify} messages. + * @param message GetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetAgentRequest.verify|verify} messages. + * @param message GetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAgentRequest + * @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.GetAgentRequest; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAgentRequest + * @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.GetAgentRequest; + + /** + * Verifies a GetAgentRequest 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 a GetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetAgentRequest; + + /** + * Creates a plain object from a GetAgentRequest message. Also converts values to other types if specified. + * @param message GetAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateAgentRequest. */ + interface ICreateAgentRequest { + + /** CreateAgentRequest parent */ + parent?: (string|null); + + /** CreateAgentRequest agent */ + agent?: (google.cloud.dialogflow.cx.v3beta1.IAgent|null); + } + + /** Represents a CreateAgentRequest. */ + class CreateAgentRequest implements ICreateAgentRequest { + + /** + * Constructs a new CreateAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest); + + /** CreateAgentRequest parent. */ + public parent: string; + + /** CreateAgentRequest agent. */ + public agent?: (google.cloud.dialogflow.cx.v3beta1.IAgent|null); + + /** + * Creates a new CreateAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest): google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest; + + /** + * Encodes the specified CreateAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest.verify|verify} messages. + * @param message CreateAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest.verify|verify} messages. + * @param message CreateAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateAgentRequest + * @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.CreateAgentRequest; + + /** + * Decodes a CreateAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateAgentRequest + * @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.CreateAgentRequest; + + /** + * Verifies a CreateAgentRequest 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 a CreateAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest; + + /** + * Creates a plain object from a CreateAgentRequest message. Also converts values to other types if specified. + * @param message CreateAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateAgentRequest. */ + interface IUpdateAgentRequest { + + /** UpdateAgentRequest agent */ + agent?: (google.cloud.dialogflow.cx.v3beta1.IAgent|null); + + /** UpdateAgentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateAgentRequest. */ + class UpdateAgentRequest implements IUpdateAgentRequest { + + /** + * Constructs a new UpdateAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest); + + /** UpdateAgentRequest agent. */ + public agent?: (google.cloud.dialogflow.cx.v3beta1.IAgent|null); + + /** UpdateAgentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest): google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest; + + /** + * Encodes the specified UpdateAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest.verify|verify} messages. + * @param message UpdateAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest.verify|verify} messages. + * @param message UpdateAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateAgentRequest + * @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.UpdateAgentRequest; + + /** + * Decodes an UpdateAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateAgentRequest + * @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.UpdateAgentRequest; + + /** + * Verifies an UpdateAgentRequest 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 UpdateAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest; + + /** + * Creates a plain object from an UpdateAgentRequest message. Also converts values to other types if specified. + * @param message UpdateAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteAgentRequest. */ + interface IDeleteAgentRequest { + + /** DeleteAgentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteAgentRequest. */ + class DeleteAgentRequest implements IDeleteAgentRequest { + + /** + * Constructs a new DeleteAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest); + + /** DeleteAgentRequest name. */ + public name: string; + + /** + * Creates a new DeleteAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest): google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest; + + /** + * Encodes the specified DeleteAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest.verify|verify} messages. + * @param message DeleteAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest.verify|verify} messages. + * @param message DeleteAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteAgentRequest + * @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.DeleteAgentRequest; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteAgentRequest + * @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.DeleteAgentRequest; + + /** + * Verifies a DeleteAgentRequest 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 a DeleteAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest; + + /** + * Creates a plain object from a DeleteAgentRequest message. Also converts values to other types if specified. + * @param message DeleteAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportAgentRequest. */ + interface IExportAgentRequest { + + /** ExportAgentRequest name */ + name?: (string|null); + + /** ExportAgentRequest agentUri */ + agentUri?: (string|null); + } + + /** Represents an ExportAgentRequest. */ + class ExportAgentRequest implements IExportAgentRequest { + + /** + * Constructs a new ExportAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest); + + /** ExportAgentRequest name. */ + public name: string; + + /** ExportAgentRequest agentUri. */ + public agentUri: string; + + /** + * Creates a new ExportAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest): google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest; + + /** + * Encodes the specified ExportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest.verify|verify} messages. + * @param message ExportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest.verify|verify} messages. + * @param message ExportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAgentRequest + * @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.ExportAgentRequest; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAgentRequest + * @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.ExportAgentRequest; + + /** + * Verifies an ExportAgentRequest 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 ExportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest; + + /** + * Creates a plain object from an ExportAgentRequest message. Also converts values to other types if specified. + * @param message ExportAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExportAgentResponse. */ + interface IExportAgentResponse { + + /** ExportAgentResponse agentUri */ + agentUri?: (string|null); + + /** ExportAgentResponse agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents an ExportAgentResponse. */ + class ExportAgentResponse implements IExportAgentResponse { + + /** + * Constructs a new ExportAgentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse); + + /** ExportAgentResponse agentUri. */ + public agentUri: string; + + /** ExportAgentResponse agentContent. */ + public agentContent: (Uint8Array|string); + + /** ExportAgentResponse agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new ExportAgentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAgentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse): google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse; + + /** + * Encodes the specified ExportAgentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse.verify|verify} messages. + * @param message ExportAgentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAgentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse.verify|verify} messages. + * @param message ExportAgentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAgentResponse + * @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.ExportAgentResponse; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAgentResponse + * @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.ExportAgentResponse; + + /** + * Verifies an ExportAgentResponse 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 ExportAgentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAgentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse; + + /** + * Creates a plain object from an ExportAgentResponse message. Also converts values to other types if specified. + * @param message ExportAgentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAgentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RestoreAgentRequest. */ + interface IRestoreAgentRequest { + + /** RestoreAgentRequest name */ + name?: (string|null); + + /** RestoreAgentRequest agentUri */ + agentUri?: (string|null); + + /** RestoreAgentRequest agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents a RestoreAgentRequest. */ + class RestoreAgentRequest implements IRestoreAgentRequest { + + /** + * Constructs a new RestoreAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest); + + /** RestoreAgentRequest name. */ + public name: string; + + /** RestoreAgentRequest agentUri. */ + public agentUri: string; + + /** RestoreAgentRequest agentContent. */ + public agentContent: (Uint8Array|string); + + /** RestoreAgentRequest agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new RestoreAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest): google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest; + + /** + * Encodes the specified RestoreAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest.verify|verify} messages. + * @param message RestoreAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest.verify|verify} messages. + * @param message RestoreAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreAgentRequest + * @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.RestoreAgentRequest; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreAgentRequest + * @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.RestoreAgentRequest; + + /** + * Verifies a RestoreAgentRequest 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 a RestoreAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest; + + /** + * Creates a plain object from a RestoreAgentRequest message. Also converts values to other types if specified. + * @param message RestoreAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a Flows */ + class Flows extends $protobuf.rpc.Service { + + /** + * Constructs a new Flows service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Flows service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Flows; + + /** + * Calls CreateFlow. + * @param request CreateFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Flow + */ + public createFlow(request: google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.CreateFlowCallback): void; + + /** + * Calls CreateFlow. + * @param request CreateFlowRequest message or plain object + * @returns Promise + */ + public createFlow(request: google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest): Promise; + + /** + * Calls DeleteFlow. + * @param request DeleteFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteFlow(request: google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.DeleteFlowCallback): void; + + /** + * Calls DeleteFlow. + * @param request DeleteFlowRequest message or plain object + * @returns Promise + */ + public deleteFlow(request: google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest): Promise; + + /** + * Calls ListFlows. + * @param request ListFlowsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListFlowsResponse + */ + public listFlows(request: google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.ListFlowsCallback): void; + + /** + * Calls ListFlows. + * @param request ListFlowsRequest message or plain object + * @returns Promise + */ + public listFlows(request: google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest): Promise; + + /** + * Calls GetFlow. + * @param request GetFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Flow + */ + public getFlow(request: google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.GetFlowCallback): void; + + /** + * Calls GetFlow. + * @param request GetFlowRequest message or plain object + * @returns Promise + */ + public getFlow(request: google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest): Promise; + + /** + * Calls UpdateFlow. + * @param request UpdateFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Flow + */ + public updateFlow(request: google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.UpdateFlowCallback): void; + + /** + * Calls UpdateFlow. + * @param request UpdateFlowRequest message or plain object + * @returns Promise + */ + public updateFlow(request: google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest): Promise; + + /** + * Calls TrainFlow. + * @param request TrainFlowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public trainFlow(request: google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, callback: google.cloud.dialogflow.cx.v3beta1.Flows.TrainFlowCallback): void; + + /** + * Calls TrainFlow. + * @param request TrainFlowRequest message or plain object + * @returns Promise + */ + public trainFlow(request: google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest): Promise; + } + + namespace Flows { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#createFlow}. + * @param error Error, if any + * @param [response] Flow + */ + type CreateFlowCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Flow) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#deleteFlow}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteFlowCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#listFlows}. + * @param error Error, if any + * @param [response] ListFlowsResponse + */ + type ListFlowsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#getFlow}. + * @param error Error, if any + * @param [response] Flow + */ + type GetFlowCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Flow) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#updateFlow}. + * @param error Error, if any + * @param [response] Flow + */ + type UpdateFlowCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Flow) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#trainFlow}. + * @param error Error, if any + * @param [response] Operation + */ + type TrainFlowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a NluSettings. */ + interface INluSettings { + + /** NluSettings modelType */ + modelType?: (google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType|keyof typeof google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType|null); + + /** NluSettings classificationThreshold */ + classificationThreshold?: (number|null); + + /** NluSettings modelTrainingMode */ + modelTrainingMode?: (google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode|keyof typeof google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode|null); + } + + /** Represents a NluSettings. */ + class NluSettings implements INluSettings { + + /** + * Constructs a new NluSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.INluSettings); + + /** NluSettings modelType. */ + public modelType: (google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType|keyof typeof google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType); + + /** NluSettings classificationThreshold. */ + public classificationThreshold: number; + + /** NluSettings modelTrainingMode. */ + public modelTrainingMode: (google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode|keyof typeof google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode); + + /** + * Creates a new NluSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns NluSettings instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.INluSettings): google.cloud.dialogflow.cx.v3beta1.NluSettings; + + /** + * Encodes the specified NluSettings message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.NluSettings.verify|verify} messages. + * @param message NluSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.INluSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NluSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.NluSettings.verify|verify} messages. + * @param message NluSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.INluSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NluSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NluSettings + * @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.NluSettings; + + /** + * Decodes a NluSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NluSettings + * @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.NluSettings; + + /** + * Verifies a NluSettings 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 a NluSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NluSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.NluSettings; + + /** + * Creates a plain object from a NluSettings message. Also converts values to other types if specified. + * @param message NluSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.NluSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NluSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace NluSettings { + + /** ModelType enum. */ + enum ModelType { + MODEL_TYPE_UNSPECIFIED = 0, + MODEL_TYPE_STANDARD = 1, + MODEL_TYPE_ADVANCED = 3 + } + + /** ModelTrainingMode enum. */ + enum ModelTrainingMode { + MODEL_TRAINING_MODE_UNSPECIFIED = 0, + MODEL_TRAINING_MODE_AUTOMATIC = 1, + MODEL_TRAINING_MODE_MANUAL = 2 + } + } + + /** Properties of a Flow. */ + interface IFlow { + + /** Flow name */ + name?: (string|null); + + /** Flow displayName */ + displayName?: (string|null); + + /** Flow description */ + description?: (string|null); + + /** Flow transitionRoutes */ + transitionRoutes?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRoute[]|null); + + /** Flow eventHandlers */ + eventHandlers?: (google.cloud.dialogflow.cx.v3beta1.IEventHandler[]|null); + + /** Flow nluSettings */ + nluSettings?: (google.cloud.dialogflow.cx.v3beta1.INluSettings|null); + } + + /** Represents a Flow. */ + class Flow implements IFlow { + + /** + * Constructs a new Flow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IFlow); + + /** Flow name. */ + public name: string; + + /** Flow displayName. */ + public displayName: string; + + /** Flow description. */ + public description: string; + + /** Flow transitionRoutes. */ + public transitionRoutes: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute[]; + + /** Flow eventHandlers. */ + public eventHandlers: google.cloud.dialogflow.cx.v3beta1.IEventHandler[]; + + /** Flow nluSettings. */ + public nluSettings?: (google.cloud.dialogflow.cx.v3beta1.INluSettings|null); + + /** + * Creates a new Flow instance using the specified properties. + * @param [properties] Properties to set + * @returns Flow instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IFlow): google.cloud.dialogflow.cx.v3beta1.Flow; + + /** + * Encodes the specified Flow message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Flow.verify|verify} messages. + * @param message Flow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IFlow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Flow message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Flow.verify|verify} messages. + * @param message Flow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IFlow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Flow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Flow + * @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.Flow; + + /** + * Decodes a Flow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Flow + * @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.Flow; + + /** + * Verifies a Flow 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 a Flow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Flow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Flow; + + /** + * Creates a plain object from a Flow message. Also converts values to other types if specified. + * @param message Flow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Flow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Flow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateFlowRequest. */ + interface ICreateFlowRequest { + + /** CreateFlowRequest parent */ + parent?: (string|null); + + /** CreateFlowRequest flow */ + flow?: (google.cloud.dialogflow.cx.v3beta1.IFlow|null); + + /** CreateFlowRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreateFlowRequest. */ + class CreateFlowRequest implements ICreateFlowRequest { + + /** + * Constructs a new CreateFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest); + + /** CreateFlowRequest parent. */ + public parent: string; + + /** CreateFlowRequest flow. */ + public flow?: (google.cloud.dialogflow.cx.v3beta1.IFlow|null); + + /** CreateFlowRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreateFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest): google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest; + + /** + * Encodes the specified CreateFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest.verify|verify} messages. + * @param message CreateFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest.verify|verify} messages. + * @param message CreateFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateFlowRequest + * @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.CreateFlowRequest; + + /** + * Decodes a CreateFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateFlowRequest + * @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.CreateFlowRequest; + + /** + * Verifies a CreateFlowRequest 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 a CreateFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest; + + /** + * Creates a plain object from a CreateFlowRequest message. Also converts values to other types if specified. + * @param message CreateFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteFlowRequest. */ + interface IDeleteFlowRequest { + + /** DeleteFlowRequest name */ + name?: (string|null); + + /** DeleteFlowRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteFlowRequest. */ + class DeleteFlowRequest implements IDeleteFlowRequest { + + /** + * Constructs a new DeleteFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest); + + /** DeleteFlowRequest name. */ + public name: string; + + /** DeleteFlowRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest): google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest; + + /** + * Encodes the specified DeleteFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest.verify|verify} messages. + * @param message DeleteFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest.verify|verify} messages. + * @param message DeleteFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteFlowRequest + * @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.DeleteFlowRequest; + + /** + * Decodes a DeleteFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteFlowRequest + * @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.DeleteFlowRequest; + + /** + * Verifies a DeleteFlowRequest 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 a DeleteFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest; + + /** + * Creates a plain object from a DeleteFlowRequest message. Also converts values to other types if specified. + * @param message DeleteFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFlowsRequest. */ + interface IListFlowsRequest { + + /** ListFlowsRequest parent */ + parent?: (string|null); + + /** ListFlowsRequest pageSize */ + pageSize?: (number|null); + + /** ListFlowsRequest pageToken */ + pageToken?: (string|null); + + /** ListFlowsRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a ListFlowsRequest. */ + class ListFlowsRequest implements IListFlowsRequest { + + /** + * Constructs a new ListFlowsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest); + + /** ListFlowsRequest parent. */ + public parent: string; + + /** ListFlowsRequest pageSize. */ + public pageSize: number; + + /** ListFlowsRequest pageToken. */ + public pageToken: string; + + /** ListFlowsRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new ListFlowsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFlowsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest): google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest; + + /** + * Encodes the specified ListFlowsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest.verify|verify} messages. + * @param message ListFlowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFlowsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest.verify|verify} messages. + * @param message ListFlowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFlowsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFlowsRequest + * @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.ListFlowsRequest; + + /** + * Decodes a ListFlowsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFlowsRequest + * @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.ListFlowsRequest; + + /** + * Verifies a ListFlowsRequest 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 a ListFlowsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFlowsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest; + + /** + * Creates a plain object from a ListFlowsRequest message. Also converts values to other types if specified. + * @param message ListFlowsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFlowsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListFlowsResponse. */ + interface IListFlowsResponse { + + /** ListFlowsResponse flows */ + flows?: (google.cloud.dialogflow.cx.v3beta1.IFlow[]|null); + + /** ListFlowsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListFlowsResponse. */ + class ListFlowsResponse implements IListFlowsResponse { + + /** + * Constructs a new ListFlowsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse); + + /** ListFlowsResponse flows. */ + public flows: google.cloud.dialogflow.cx.v3beta1.IFlow[]; + + /** ListFlowsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListFlowsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListFlowsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse): google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse; + + /** + * Encodes the specified ListFlowsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse.verify|verify} messages. + * @param message ListFlowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListFlowsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse.verify|verify} messages. + * @param message ListFlowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListFlowsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListFlowsResponse + * @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.ListFlowsResponse; + + /** + * Decodes a ListFlowsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListFlowsResponse + * @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.ListFlowsResponse; + + /** + * Verifies a ListFlowsResponse 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 a ListFlowsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListFlowsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse; + + /** + * Creates a plain object from a ListFlowsResponse message. Also converts values to other types if specified. + * @param message ListFlowsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListFlowsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetFlowRequest. */ + interface IGetFlowRequest { + + /** GetFlowRequest name */ + name?: (string|null); + + /** GetFlowRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetFlowRequest. */ + class GetFlowRequest implements IGetFlowRequest { + + /** + * Constructs a new GetFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest); + + /** GetFlowRequest name. */ + public name: string; + + /** GetFlowRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest): google.cloud.dialogflow.cx.v3beta1.GetFlowRequest; + + /** + * Encodes the specified GetFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetFlowRequest.verify|verify} messages. + * @param message GetFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetFlowRequest.verify|verify} messages. + * @param message GetFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFlowRequest + * @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.GetFlowRequest; + + /** + * Decodes a GetFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFlowRequest + * @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.GetFlowRequest; + + /** + * Verifies a GetFlowRequest 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 a GetFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetFlowRequest; + + /** + * Creates a plain object from a GetFlowRequest message. Also converts values to other types if specified. + * @param message GetFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateFlowRequest. */ + interface IUpdateFlowRequest { + + /** UpdateFlowRequest flow */ + flow?: (google.cloud.dialogflow.cx.v3beta1.IFlow|null); + + /** UpdateFlowRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateFlowRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents an UpdateFlowRequest. */ + class UpdateFlowRequest implements IUpdateFlowRequest { + + /** + * Constructs a new UpdateFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest); + + /** UpdateFlowRequest flow. */ + public flow?: (google.cloud.dialogflow.cx.v3beta1.IFlow|null); + + /** UpdateFlowRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateFlowRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new UpdateFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest): google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest; + + /** + * Encodes the specified UpdateFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest.verify|verify} messages. + * @param message UpdateFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest.verify|verify} messages. + * @param message UpdateFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFlowRequest + * @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.UpdateFlowRequest; + + /** + * Decodes an UpdateFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFlowRequest + * @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.UpdateFlowRequest; + + /** + * Verifies an UpdateFlowRequest 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 UpdateFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest; + + /** + * Creates a plain object from an UpdateFlowRequest message. Also converts values to other types if specified. + * @param message UpdateFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TrainFlowRequest. */ + interface ITrainFlowRequest { + + /** TrainFlowRequest name */ + name?: (string|null); + } + + /** Represents a TrainFlowRequest. */ + class TrainFlowRequest implements ITrainFlowRequest { + + /** + * Constructs a new TrainFlowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest); + + /** TrainFlowRequest name. */ + public name: string; + + /** + * Creates a new TrainFlowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TrainFlowRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest): google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest; + + /** + * Encodes the specified TrainFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest.verify|verify} messages. + * @param message TrainFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TrainFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest.verify|verify} messages. + * @param message TrainFlowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TrainFlowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TrainFlowRequest + * @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.TrainFlowRequest; + + /** + * Decodes a TrainFlowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TrainFlowRequest + * @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.TrainFlowRequest; + + /** + * Verifies a TrainFlowRequest 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 a TrainFlowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TrainFlowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest; + + /** + * Creates a plain object from a TrainFlowRequest message. Also converts values to other types if specified. + * @param message TrainFlowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TrainFlowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a Pages */ + class Pages extends $protobuf.rpc.Service { + + /** + * Constructs a new Pages service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Pages service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Pages; + + /** + * Calls ListPages. + * @param request ListPagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListPagesResponse + */ + public listPages(request: google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, callback: google.cloud.dialogflow.cx.v3beta1.Pages.ListPagesCallback): void; + + /** + * Calls ListPages. + * @param request ListPagesRequest message or plain object + * @returns Promise + */ + public listPages(request: google.cloud.dialogflow.cx.v3beta1.IListPagesRequest): Promise; + + /** + * Calls GetPage. + * @param request GetPageRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Page + */ + public getPage(request: google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, callback: google.cloud.dialogflow.cx.v3beta1.Pages.GetPageCallback): void; + + /** + * Calls GetPage. + * @param request GetPageRequest message or plain object + * @returns Promise + */ + public getPage(request: google.cloud.dialogflow.cx.v3beta1.IGetPageRequest): Promise; + + /** + * Calls CreatePage. + * @param request CreatePageRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Page + */ + public createPage(request: google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, callback: google.cloud.dialogflow.cx.v3beta1.Pages.CreatePageCallback): void; + + /** + * Calls CreatePage. + * @param request CreatePageRequest message or plain object + * @returns Promise + */ + public createPage(request: google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest): Promise; + + /** + * Calls UpdatePage. + * @param request UpdatePageRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Page + */ + public updatePage(request: google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, callback: google.cloud.dialogflow.cx.v3beta1.Pages.UpdatePageCallback): void; + + /** + * Calls UpdatePage. + * @param request UpdatePageRequest message or plain object + * @returns Promise + */ + public updatePage(request: google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest): Promise; + + /** + * Calls DeletePage. + * @param request DeletePageRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deletePage(request: google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, callback: google.cloud.dialogflow.cx.v3beta1.Pages.DeletePageCallback): void; + + /** + * Calls DeletePage. + * @param request DeletePageRequest message or plain object + * @returns Promise + */ + public deletePage(request: google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest): Promise; + } + + namespace Pages { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#listPages}. + * @param error Error, if any + * @param [response] ListPagesResponse + */ + type ListPagesCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListPagesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#getPage}. + * @param error Error, if any + * @param [response] Page + */ + type GetPageCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Page) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#createPage}. + * @param error Error, if any + * @param [response] Page + */ + type CreatePageCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Page) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#updatePage}. + * @param error Error, if any + * @param [response] Page + */ + type UpdatePageCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Page) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#deletePage}. + * @param error Error, if any + * @param [response] Empty + */ + type DeletePageCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a Page. */ + interface IPage { + + /** Page name */ + name?: (string|null); + + /** Page displayName */ + displayName?: (string|null); + + /** Page entryFulfillment */ + entryFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** Page form */ + form?: (google.cloud.dialogflow.cx.v3beta1.IForm|null); + + /** Page transitionRouteGroups */ + transitionRouteGroups?: (string[]|null); + + /** Page transitionRoutes */ + transitionRoutes?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRoute[]|null); + + /** Page eventHandlers */ + eventHandlers?: (google.cloud.dialogflow.cx.v3beta1.IEventHandler[]|null); + } + + /** Represents a Page. */ + class Page implements IPage { + + /** + * Constructs a new Page. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IPage); + + /** Page name. */ + public name: string; + + /** Page displayName. */ + public displayName: string; + + /** Page entryFulfillment. */ + public entryFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** Page form. */ + public form?: (google.cloud.dialogflow.cx.v3beta1.IForm|null); + + /** Page transitionRouteGroups. */ + public transitionRouteGroups: string[]; + + /** Page transitionRoutes. */ + public transitionRoutes: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute[]; + + /** Page eventHandlers. */ + public eventHandlers: google.cloud.dialogflow.cx.v3beta1.IEventHandler[]; + + /** + * Creates a new Page instance using the specified properties. + * @param [properties] Properties to set + * @returns Page instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IPage): google.cloud.dialogflow.cx.v3beta1.Page; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Page.verify|verify} messages. + * @param message Page message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IPage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Page message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Page + * @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.Page; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Page + * @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.Page; + + /** + * Verifies a Page 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 a Page message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Page + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Page; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @param message Page + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Page, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Page to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Form. */ + interface IForm { + + /** Form parameters */ + parameters?: (google.cloud.dialogflow.cx.v3beta1.Form.IParameter[]|null); + } + + /** Represents a Form. */ + class Form implements IForm { + + /** + * Constructs a new Form. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IForm); + + /** Form parameters. */ + public parameters: google.cloud.dialogflow.cx.v3beta1.Form.IParameter[]; + + /** + * Creates a new Form instance using the specified properties. + * @param [properties] Properties to set + * @returns Form instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IForm): google.cloud.dialogflow.cx.v3beta1.Form; + + /** + * Encodes the specified Form message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.verify|verify} messages. + * @param message Form message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IForm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Form message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.verify|verify} messages. + * @param message Form message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IForm, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Form message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Form + * @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.Form; + + /** + * Decodes a Form message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Form + * @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.Form; + + /** + * Verifies a Form 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 a Form message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Form + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Form; + + /** + * Creates a plain object from a Form message. Also converts values to other types if specified. + * @param message Form + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Form, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Form to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Form { + + /** Properties of a Parameter. */ + interface IParameter { + + /** Parameter displayName */ + displayName?: (string|null); + + /** Parameter required */ + required?: (boolean|null); + + /** Parameter entityType */ + entityType?: (string|null); + + /** Parameter isList */ + isList?: (boolean|null); + + /** Parameter fillBehavior */ + fillBehavior?: (google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior|null); + + /** Parameter defaultValue */ + defaultValue?: (google.protobuf.IValue|null); + + /** Parameter redact */ + redact?: (boolean|null); + } + + /** Represents a Parameter. */ + class Parameter implements IParameter { + + /** + * Constructs a new Parameter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Form.IParameter); + + /** Parameter displayName. */ + public displayName: string; + + /** Parameter required. */ + public required: boolean; + + /** Parameter entityType. */ + public entityType: string; + + /** Parameter isList. */ + public isList: boolean; + + /** Parameter fillBehavior. */ + public fillBehavior?: (google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior|null); + + /** Parameter defaultValue. */ + public defaultValue?: (google.protobuf.IValue|null); + + /** Parameter redact. */ + public redact: boolean; + + /** + * Creates a new Parameter instance using the specified properties. + * @param [properties] Properties to set + * @returns Parameter instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Form.IParameter): google.cloud.dialogflow.cx.v3beta1.Form.Parameter; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Form.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Form.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Parameter + * @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.Form.Parameter; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Parameter + * @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.Form.Parameter; + + /** + * Verifies a Parameter 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 a Parameter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Parameter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Form.Parameter; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @param message Parameter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Form.Parameter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Parameter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Parameter { + + /** Properties of a FillBehavior. */ + interface IFillBehavior { + + /** FillBehavior initialPromptFulfillment */ + initialPromptFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** FillBehavior repromptEventHandlers */ + repromptEventHandlers?: (google.cloud.dialogflow.cx.v3beta1.IEventHandler[]|null); + } + + /** Represents a FillBehavior. */ + class FillBehavior implements IFillBehavior { + + /** + * Constructs a new FillBehavior. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior); + + /** FillBehavior initialPromptFulfillment. */ + public initialPromptFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** FillBehavior repromptEventHandlers. */ + public repromptEventHandlers: google.cloud.dialogflow.cx.v3beta1.IEventHandler[]; + + /** + * Creates a new FillBehavior instance using the specified properties. + * @param [properties] Properties to set + * @returns FillBehavior instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior): google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior; + + /** + * Encodes the specified FillBehavior message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.verify|verify} messages. + * @param message FillBehavior message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FillBehavior message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.verify|verify} messages. + * @param message FillBehavior message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FillBehavior message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FillBehavior + * @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.Form.Parameter.FillBehavior; + + /** + * Decodes a FillBehavior message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FillBehavior + * @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.Form.Parameter.FillBehavior; + + /** + * Verifies a FillBehavior 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 a FillBehavior message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FillBehavior + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior; + + /** + * Creates a plain object from a FillBehavior message. Also converts values to other types if specified. + * @param message FillBehavior + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FillBehavior to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + + /** Properties of an EventHandler. */ + interface IEventHandler { + + /** EventHandler name */ + name?: (string|null); + + /** EventHandler event */ + event?: (string|null); + + /** EventHandler triggerFulfillment */ + triggerFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** EventHandler targetPage */ + targetPage?: (string|null); + + /** EventHandler targetFlow */ + targetFlow?: (string|null); + } + + /** Represents an EventHandler. */ + class EventHandler implements IEventHandler { + + /** + * Constructs a new EventHandler. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IEventHandler); + + /** EventHandler name. */ + public name: string; + + /** EventHandler event. */ + public event: string; + + /** EventHandler triggerFulfillment. */ + public triggerFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** EventHandler targetPage. */ + public targetPage: string; + + /** EventHandler targetFlow. */ + public targetFlow: string; + + /** EventHandler target. */ + public target?: ("targetPage"|"targetFlow"); + + /** + * Creates a new EventHandler instance using the specified properties. + * @param [properties] Properties to set + * @returns EventHandler instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IEventHandler): google.cloud.dialogflow.cx.v3beta1.EventHandler; + + /** + * Encodes the specified EventHandler message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventHandler.verify|verify} messages. + * @param message EventHandler message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IEventHandler, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventHandler message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventHandler.verify|verify} messages. + * @param message EventHandler message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IEventHandler, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventHandler message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventHandler + * @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.EventHandler; + + /** + * Decodes an EventHandler message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventHandler + * @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.EventHandler; + + /** + * Verifies an EventHandler 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 EventHandler message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventHandler + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.EventHandler; + + /** + * Creates a plain object from an EventHandler message. Also converts values to other types if specified. + * @param message EventHandler + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.EventHandler, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventHandler to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TransitionRoute. */ + interface ITransitionRoute { + + /** TransitionRoute name */ + name?: (string|null); + + /** TransitionRoute intent */ + intent?: (string|null); + + /** TransitionRoute condition */ + condition?: (string|null); + + /** TransitionRoute triggerFulfillment */ + triggerFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** TransitionRoute targetPage */ + targetPage?: (string|null); + + /** TransitionRoute targetFlow */ + targetFlow?: (string|null); + } + + /** Represents a TransitionRoute. */ + class TransitionRoute implements ITransitionRoute { + + /** + * Constructs a new TransitionRoute. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute); + + /** TransitionRoute name. */ + public name: string; + + /** TransitionRoute intent. */ + public intent: string; + + /** TransitionRoute condition. */ + public condition: string; + + /** TransitionRoute triggerFulfillment. */ + public triggerFulfillment?: (google.cloud.dialogflow.cx.v3beta1.IFulfillment|null); + + /** TransitionRoute targetPage. */ + public targetPage: string; + + /** TransitionRoute targetFlow. */ + public targetFlow: string; + + /** TransitionRoute target. */ + public target?: ("targetPage"|"targetFlow"); + + /** + * Creates a new TransitionRoute instance using the specified properties. + * @param [properties] Properties to set + * @returns TransitionRoute instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute): google.cloud.dialogflow.cx.v3beta1.TransitionRoute; + + /** + * Encodes the specified TransitionRoute message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify|verify} messages. + * @param message TransitionRoute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TransitionRoute message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify|verify} messages. + * @param message TransitionRoute message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TransitionRoute message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TransitionRoute + * @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.TransitionRoute; + + /** + * Decodes a TransitionRoute message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TransitionRoute + * @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.TransitionRoute; + + /** + * Verifies a TransitionRoute 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 a TransitionRoute message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TransitionRoute + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.TransitionRoute; + + /** + * Creates a plain object from a TransitionRoute message. Also converts values to other types if specified. + * @param message TransitionRoute + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.TransitionRoute, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TransitionRoute to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListPagesRequest. */ + interface IListPagesRequest { + + /** ListPagesRequest parent */ + parent?: (string|null); + + /** ListPagesRequest languageCode */ + languageCode?: (string|null); + + /** ListPagesRequest pageSize */ + pageSize?: (number|null); + + /** ListPagesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListPagesRequest. */ + class ListPagesRequest implements IListPagesRequest { + + /** + * Constructs a new ListPagesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListPagesRequest); + + /** ListPagesRequest parent. */ + public parent: string; + + /** ListPagesRequest languageCode. */ + public languageCode: string; + + /** ListPagesRequest pageSize. */ + public pageSize: number; + + /** ListPagesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListPagesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListPagesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListPagesRequest): google.cloud.dialogflow.cx.v3beta1.ListPagesRequest; + + /** + * Encodes the specified ListPagesRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesRequest.verify|verify} messages. + * @param message ListPagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListPagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesRequest.verify|verify} messages. + * @param message ListPagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListPagesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListPagesRequest + * @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.ListPagesRequest; + + /** + * Decodes a ListPagesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListPagesRequest + * @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.ListPagesRequest; + + /** + * Verifies a ListPagesRequest 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 a ListPagesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListPagesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListPagesRequest; + + /** + * Creates a plain object from a ListPagesRequest message. Also converts values to other types if specified. + * @param message ListPagesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListPagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListPagesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListPagesResponse. */ + interface IListPagesResponse { + + /** ListPagesResponse pages */ + pages?: (google.cloud.dialogflow.cx.v3beta1.IPage[]|null); + + /** ListPagesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListPagesResponse. */ + class ListPagesResponse implements IListPagesResponse { + + /** + * Constructs a new ListPagesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListPagesResponse); + + /** ListPagesResponse pages. */ + public pages: google.cloud.dialogflow.cx.v3beta1.IPage[]; + + /** ListPagesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListPagesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListPagesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListPagesResponse): google.cloud.dialogflow.cx.v3beta1.ListPagesResponse; + + /** + * Encodes the specified ListPagesResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesResponse.verify|verify} messages. + * @param message ListPagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListPagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListPagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesResponse.verify|verify} messages. + * @param message ListPagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListPagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListPagesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListPagesResponse + * @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.ListPagesResponse; + + /** + * Decodes a ListPagesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListPagesResponse + * @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.ListPagesResponse; + + /** + * Verifies a ListPagesResponse 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 a ListPagesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListPagesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListPagesResponse; + + /** + * Creates a plain object from a ListPagesResponse message. Also converts values to other types if specified. + * @param message ListPagesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListPagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListPagesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetPageRequest. */ + interface IGetPageRequest { + + /** GetPageRequest name */ + name?: (string|null); + + /** GetPageRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetPageRequest. */ + class GetPageRequest implements IGetPageRequest { + + /** + * Constructs a new GetPageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetPageRequest); + + /** GetPageRequest name. */ + public name: string; + + /** GetPageRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetPageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetPageRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetPageRequest): google.cloud.dialogflow.cx.v3beta1.GetPageRequest; + + /** + * Encodes the specified GetPageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetPageRequest.verify|verify} messages. + * @param message GetPageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetPageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetPageRequest.verify|verify} messages. + * @param message GetPageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetPageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetPageRequest + * @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.GetPageRequest; + + /** + * Decodes a GetPageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetPageRequest + * @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.GetPageRequest; + + /** + * Verifies a GetPageRequest 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 a GetPageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetPageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetPageRequest; + + /** + * Creates a plain object from a GetPageRequest message. Also converts values to other types if specified. + * @param message GetPageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetPageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetPageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreatePageRequest. */ + interface ICreatePageRequest { + + /** CreatePageRequest parent */ + parent?: (string|null); + + /** CreatePageRequest page */ + page?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** CreatePageRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreatePageRequest. */ + class CreatePageRequest implements ICreatePageRequest { + + /** + * Constructs a new CreatePageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest); + + /** CreatePageRequest parent. */ + public parent: string; + + /** CreatePageRequest page. */ + public page?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** CreatePageRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreatePageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreatePageRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest): google.cloud.dialogflow.cx.v3beta1.CreatePageRequest; + + /** + * Encodes the specified CreatePageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreatePageRequest.verify|verify} messages. + * @param message CreatePageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreatePageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreatePageRequest.verify|verify} messages. + * @param message CreatePageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreatePageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreatePageRequest + * @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.CreatePageRequest; + + /** + * Decodes a CreatePageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreatePageRequest + * @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.CreatePageRequest; + + /** + * Verifies a CreatePageRequest 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 a CreatePageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreatePageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreatePageRequest; + + /** + * Creates a plain object from a CreatePageRequest message. Also converts values to other types if specified. + * @param message CreatePageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreatePageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreatePageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdatePageRequest. */ + interface IUpdatePageRequest { + + /** UpdatePageRequest page */ + page?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** UpdatePageRequest languageCode */ + languageCode?: (string|null); + + /** UpdatePageRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdatePageRequest. */ + class UpdatePageRequest implements IUpdatePageRequest { + + /** + * Constructs a new UpdatePageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest); + + /** UpdatePageRequest page. */ + public page?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** UpdatePageRequest languageCode. */ + public languageCode: string; + + /** UpdatePageRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdatePageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdatePageRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest): google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest; + + /** + * Encodes the specified UpdatePageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest.verify|verify} messages. + * @param message UpdatePageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdatePageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest.verify|verify} messages. + * @param message UpdatePageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdatePageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdatePageRequest + * @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.UpdatePageRequest; + + /** + * Decodes an UpdatePageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdatePageRequest + * @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.UpdatePageRequest; + + /** + * Verifies an UpdatePageRequest 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 UpdatePageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdatePageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest; + + /** + * Creates a plain object from an UpdatePageRequest message. Also converts values to other types if specified. + * @param message UpdatePageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdatePageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeletePageRequest. */ + interface IDeletePageRequest { + + /** DeletePageRequest name */ + name?: (string|null); + + /** DeletePageRequest force */ + force?: (boolean|null); + } + + /** Represents a DeletePageRequest. */ + class DeletePageRequest implements IDeletePageRequest { + + /** + * Constructs a new DeletePageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest); + + /** DeletePageRequest name. */ + public name: string; + + /** DeletePageRequest force. */ + public force: boolean; + + /** + * Creates a new DeletePageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeletePageRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest): google.cloud.dialogflow.cx.v3beta1.DeletePageRequest; + + /** + * Encodes the specified DeletePageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeletePageRequest.verify|verify} messages. + * @param message DeletePageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeletePageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeletePageRequest.verify|verify} messages. + * @param message DeletePageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeletePageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeletePageRequest + * @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.DeletePageRequest; + + /** + * Decodes a DeletePageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeletePageRequest + * @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.DeletePageRequest; + + /** + * Verifies a DeletePageRequest 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 a DeletePageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeletePageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeletePageRequest; + + /** + * Creates a plain object from a DeletePageRequest message. Also converts values to other types if specified. + * @param message DeletePageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeletePageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeletePageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Fulfillment. */ + interface IFulfillment { + + /** Fulfillment messages */ + messages?: (google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]|null); + + /** Fulfillment webhook */ + webhook?: (string|null); + + /** Fulfillment tag */ + tag?: (string|null); + + /** Fulfillment setParameterActions */ + setParameterActions?: (google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction[]|null); + + /** Fulfillment conditionalCases */ + conditionalCases?: (google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases[]|null); + } + + /** Represents a Fulfillment. */ + class Fulfillment implements IFulfillment { + + /** + * Constructs a new Fulfillment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IFulfillment); + + /** Fulfillment messages. */ + public messages: google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]; + + /** Fulfillment webhook. */ + public webhook: string; + + /** Fulfillment tag. */ + public tag: string; + + /** Fulfillment setParameterActions. */ + public setParameterActions: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction[]; + + /** Fulfillment conditionalCases. */ + public conditionalCases: google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases[]; + + /** + * Creates a new Fulfillment instance using the specified properties. + * @param [properties] Properties to set + * @returns Fulfillment instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IFulfillment): google.cloud.dialogflow.cx.v3beta1.Fulfillment; + + /** + * Encodes the specified Fulfillment message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify|verify} messages. + * @param message Fulfillment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IFulfillment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Fulfillment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify|verify} messages. + * @param message Fulfillment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IFulfillment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Fulfillment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Fulfillment + * @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.Fulfillment; + + /** + * Decodes a Fulfillment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Fulfillment + * @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.Fulfillment; + + /** + * Verifies a Fulfillment 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 a Fulfillment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Fulfillment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Fulfillment; + + /** + * Creates a plain object from a Fulfillment message. Also converts values to other types if specified. + * @param message Fulfillment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Fulfillment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Fulfillment { + + /** Properties of a SetParameterAction. */ + interface ISetParameterAction { + + /** SetParameterAction parameter */ + parameter?: (string|null); + + /** SetParameterAction value */ + value?: (google.protobuf.IValue|null); + } + + /** Represents a SetParameterAction. */ + class SetParameterAction implements ISetParameterAction { + + /** + * Constructs a new SetParameterAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction); + + /** SetParameterAction parameter. */ + public parameter: string; + + /** SetParameterAction value. */ + public value?: (google.protobuf.IValue|null); + + /** + * Creates a new SetParameterAction instance using the specified properties. + * @param [properties] Properties to set + * @returns SetParameterAction instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction): google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction; + + /** + * Encodes the specified SetParameterAction message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.verify|verify} messages. + * @param message SetParameterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetParameterAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.verify|verify} messages. + * @param message SetParameterAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetParameterAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetParameterAction + * @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.Fulfillment.SetParameterAction; + + /** + * Decodes a SetParameterAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetParameterAction + * @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.Fulfillment.SetParameterAction; + + /** + * Verifies a SetParameterAction 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 a SetParameterAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetParameterAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction; + + /** + * Creates a plain object from a SetParameterAction message. Also converts values to other types if specified. + * @param message SetParameterAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetParameterAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ConditionalCases. */ + interface IConditionalCases { + + /** ConditionalCases cases */ + cases?: (google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase[]|null); + } + + /** Represents a ConditionalCases. */ + class ConditionalCases implements IConditionalCases { + + /** + * Constructs a new ConditionalCases. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases); + + /** ConditionalCases cases. */ + public cases: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase[]; + + /** + * Creates a new ConditionalCases instance using the specified properties. + * @param [properties] Properties to set + * @returns ConditionalCases instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases): google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases; + + /** + * Encodes the specified ConditionalCases message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.verify|verify} messages. + * @param message ConditionalCases message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConditionalCases message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.verify|verify} messages. + * @param message ConditionalCases message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConditionalCases message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConditionalCases + * @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.Fulfillment.ConditionalCases; + + /** + * Decodes a ConditionalCases message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConditionalCases + * @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.Fulfillment.ConditionalCases; + + /** + * Verifies a ConditionalCases 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 a ConditionalCases message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConditionalCases + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases; + + /** + * Creates a plain object from a ConditionalCases message. Also converts values to other types if specified. + * @param message ConditionalCases + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConditionalCases to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ConditionalCases { + + /** Properties of a Case. */ + interface ICase { + + /** Case condition */ + condition?: (string|null); + + /** Case caseContent */ + caseContent?: (google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent[]|null); + } + + /** Represents a Case. */ + class Case implements ICase { + + /** + * Constructs a new Case. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase); + + /** Case condition. */ + public condition: string; + + /** Case caseContent. */ + public caseContent: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent[]; + + /** + * Creates a new Case instance using the specified properties. + * @param [properties] Properties to set + * @returns Case instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase): google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case; + + /** + * Encodes the specified Case message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.verify|verify} messages. + * @param message Case message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Case message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.verify|verify} messages. + * @param message Case message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Case message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Case + * @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.Fulfillment.ConditionalCases.Case; + + /** + * Decodes a Case message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Case + * @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.Fulfillment.ConditionalCases.Case; + + /** + * Verifies a Case 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 a Case message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Case + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case; + + /** + * Creates a plain object from a Case message. Also converts values to other types if specified. + * @param message Case + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Case to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Case { + + /** Properties of a CaseContent. */ + interface ICaseContent { + + /** CaseContent message */ + message?: (google.cloud.dialogflow.cx.v3beta1.IResponseMessage|null); + + /** CaseContent additionalCases */ + additionalCases?: (google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases|null); + } + + /** Represents a CaseContent. */ + class CaseContent implements ICaseContent { + + /** + * Constructs a new CaseContent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent); + + /** CaseContent message. */ + public message?: (google.cloud.dialogflow.cx.v3beta1.IResponseMessage|null); + + /** CaseContent additionalCases. */ + public additionalCases?: (google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases|null); + + /** CaseContent casesOrMessage. */ + public casesOrMessage?: ("message"|"additionalCases"); + + /** + * Creates a new CaseContent instance using the specified properties. + * @param [properties] Properties to set + * @returns CaseContent instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent): google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent; + + /** + * Encodes the specified CaseContent message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.verify|verify} messages. + * @param message CaseContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CaseContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.verify|verify} messages. + * @param message CaseContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CaseContent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CaseContent + * @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.Fulfillment.ConditionalCases.Case.CaseContent; + + /** + * Decodes a CaseContent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CaseContent + * @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.Fulfillment.ConditionalCases.Case.CaseContent; + + /** + * Verifies a CaseContent 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 a CaseContent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CaseContent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent; + + /** + * Creates a plain object from a CaseContent message. Also converts values to other types if specified. + * @param message CaseContent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CaseContent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + } + + /** Properties of a ResponseMessage. */ + interface IResponseMessage { + + /** ResponseMessage text */ + text?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText|null); + + /** ResponseMessage payload */ + payload?: (google.protobuf.IStruct|null); + + /** ResponseMessage conversationSuccess */ + conversationSuccess?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess|null); + + /** ResponseMessage outputAudioText */ + outputAudioText?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText|null); + + /** ResponseMessage liveAgentHandoff */ + liveAgentHandoff?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff|null); + + /** ResponseMessage endInteraction */ + endInteraction?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction|null); + + /** ResponseMessage playAudio */ + playAudio?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio|null); + + /** ResponseMessage mixedAudio */ + mixedAudio?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio|null); + } + + /** Represents a ResponseMessage. */ + class ResponseMessage implements IResponseMessage { + + /** + * Constructs a new ResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IResponseMessage); + + /** ResponseMessage text. */ + public text?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText|null); + + /** ResponseMessage payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** ResponseMessage conversationSuccess. */ + public conversationSuccess?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess|null); + + /** ResponseMessage outputAudioText. */ + public outputAudioText?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText|null); + + /** ResponseMessage liveAgentHandoff. */ + public liveAgentHandoff?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff|null); + + /** ResponseMessage endInteraction. */ + public endInteraction?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction|null); + + /** ResponseMessage playAudio. */ + public playAudio?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio|null); + + /** ResponseMessage mixedAudio. */ + public mixedAudio?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio|null); + + /** ResponseMessage message. */ + public message?: ("text"|"payload"|"conversationSuccess"|"outputAudioText"|"liveAgentHandoff"|"endInteraction"|"playAudio"|"mixedAudio"); + + /** + * Creates a new ResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ResponseMessage instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IResponseMessage): google.cloud.dialogflow.cx.v3beta1.ResponseMessage; + + /** + * Encodes the specified ResponseMessage message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify|verify} messages. + * @param message ResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResponseMessage message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify|verify} messages. + * @param message ResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResponseMessage + * @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.ResponseMessage; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResponseMessage + * @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.ResponseMessage; + + /** + * Verifies a ResponseMessage 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 a ResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResponseMessage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage; + + /** + * Creates a plain object from a ResponseMessage message. Also converts values to other types if specified. + * @param message ResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResponseMessage { + + /** Properties of a Text. */ + interface IText { + + /** Text text */ + text?: (string[]|null); + + /** Text allowPlaybackInterruption */ + allowPlaybackInterruption?: (boolean|null); + } + + /** Represents a Text. */ + class Text implements IText { + + /** + * Constructs a new Text. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText); + + /** Text text. */ + public text: string[]; + + /** Text allowPlaybackInterruption. */ + public allowPlaybackInterruption: boolean; + + /** + * Creates a new Text instance using the specified properties. + * @param [properties] Properties to set + * @returns Text instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Text message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Text + * @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.ResponseMessage.Text; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Text + * @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.ResponseMessage.Text; + + /** + * Verifies a Text 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 a Text message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Text + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @param message Text + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Text to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LiveAgentHandoff. */ + interface ILiveAgentHandoff { + + /** LiveAgentHandoff metadata */ + metadata?: (google.protobuf.IStruct|null); + } + + /** Represents a LiveAgentHandoff. */ + class LiveAgentHandoff implements ILiveAgentHandoff { + + /** + * Constructs a new LiveAgentHandoff. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff); + + /** LiveAgentHandoff metadata. */ + public metadata?: (google.protobuf.IStruct|null); + + /** + * Creates a new LiveAgentHandoff instance using the specified properties. + * @param [properties] Properties to set + * @returns LiveAgentHandoff instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff; + + /** + * Encodes the specified LiveAgentHandoff message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @param message LiveAgentHandoff message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LiveAgentHandoff message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @param message LiveAgentHandoff message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LiveAgentHandoff + * @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.ResponseMessage.LiveAgentHandoff; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LiveAgentHandoff + * @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.ResponseMessage.LiveAgentHandoff; + + /** + * Verifies a LiveAgentHandoff 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 a LiveAgentHandoff message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LiveAgentHandoff + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff; + + /** + * Creates a plain object from a LiveAgentHandoff message. Also converts values to other types if specified. + * @param message LiveAgentHandoff + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LiveAgentHandoff to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ConversationSuccess. */ + interface IConversationSuccess { + + /** ConversationSuccess metadata */ + metadata?: (google.protobuf.IStruct|null); + } + + /** Represents a ConversationSuccess. */ + class ConversationSuccess implements IConversationSuccess { + + /** + * Constructs a new ConversationSuccess. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess); + + /** ConversationSuccess metadata. */ + public metadata?: (google.protobuf.IStruct|null); + + /** + * Creates a new ConversationSuccess instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationSuccess instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess; + + /** + * Encodes the specified ConversationSuccess message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.verify|verify} messages. + * @param message ConversationSuccess message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationSuccess message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.verify|verify} messages. + * @param message ConversationSuccess message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationSuccess message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationSuccess + * @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.ResponseMessage.ConversationSuccess; + + /** + * Decodes a ConversationSuccess message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationSuccess + * @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.ResponseMessage.ConversationSuccess; + + /** + * Verifies a ConversationSuccess 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 a ConversationSuccess message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationSuccess + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess; + + /** + * Creates a plain object from a ConversationSuccess message. Also converts values to other types if specified. + * @param message ConversationSuccess + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationSuccess to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OutputAudioText. */ + interface IOutputAudioText { + + /** OutputAudioText text */ + text?: (string|null); + + /** OutputAudioText ssml */ + ssml?: (string|null); + + /** OutputAudioText allowPlaybackInterruption */ + allowPlaybackInterruption?: (boolean|null); + } + + /** Represents an OutputAudioText. */ + class OutputAudioText implements IOutputAudioText { + + /** + * Constructs a new OutputAudioText. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText); + + /** OutputAudioText text. */ + public text: string; + + /** OutputAudioText ssml. */ + public ssml: string; + + /** OutputAudioText allowPlaybackInterruption. */ + public allowPlaybackInterruption: boolean; + + /** OutputAudioText source. */ + public source?: ("text"|"ssml"); + + /** + * Creates a new OutputAudioText instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputAudioText instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText; + + /** + * Encodes the specified OutputAudioText message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.verify|verify} messages. + * @param message OutputAudioText message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputAudioText message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.verify|verify} messages. + * @param message OutputAudioText message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputAudioText message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputAudioText + * @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.ResponseMessage.OutputAudioText; + + /** + * Decodes an OutputAudioText message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputAudioText + * @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.ResponseMessage.OutputAudioText; + + /** + * Verifies an OutputAudioText 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 OutputAudioText message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputAudioText + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText; + + /** + * Creates a plain object from an OutputAudioText message. Also converts values to other types if specified. + * @param message OutputAudioText + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputAudioText to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MixedAudio. */ + interface IMixedAudio { + + /** MixedAudio segments */ + segments?: (google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment[]|null); + } + + /** Represents a MixedAudio. */ + class MixedAudio implements IMixedAudio { + + /** + * Constructs a new MixedAudio. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio); + + /** MixedAudio segments. */ + public segments: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment[]; + + /** + * Creates a new MixedAudio instance using the specified properties. + * @param [properties] Properties to set + * @returns MixedAudio instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio; + + /** + * Encodes the specified MixedAudio message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @param message MixedAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MixedAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @param message MixedAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MixedAudio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MixedAudio + * @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.ResponseMessage.MixedAudio; + + /** + * Decodes a MixedAudio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MixedAudio + * @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.ResponseMessage.MixedAudio; + + /** + * Verifies a MixedAudio 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 a MixedAudio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MixedAudio + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio; + + /** + * Creates a plain object from a MixedAudio message. Also converts values to other types if specified. + * @param message MixedAudio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MixedAudio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace MixedAudio { + + /** Properties of a Segment. */ + interface ISegment { + + /** Segment audio */ + audio?: (Uint8Array|string|null); + + /** Segment uri */ + uri?: (string|null); + + /** Segment allowPlaybackInterruption */ + allowPlaybackInterruption?: (boolean|null); + } + + /** Represents a Segment. */ + class Segment implements ISegment { + + /** + * Constructs a new Segment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment); + + /** Segment audio. */ + public audio: (Uint8Array|string); + + /** Segment uri. */ + public uri: string; + + /** Segment allowPlaybackInterruption. */ + public allowPlaybackInterruption: boolean; + + /** Segment content. */ + public content?: ("audio"|"uri"); + + /** + * Creates a new Segment instance using the specified properties. + * @param [properties] Properties to set + * @returns Segment instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment; + + /** + * Encodes the specified Segment message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @param message Segment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Segment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @param message Segment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Segment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Segment + * @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.ResponseMessage.MixedAudio.Segment; + + /** + * Decodes a Segment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Segment + * @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.ResponseMessage.MixedAudio.Segment; + + /** + * Verifies a Segment 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 a Segment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Segment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment; + + /** + * Creates a plain object from a Segment message. Also converts values to other types if specified. + * @param message Segment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Segment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EndInteraction. */ + interface IEndInteraction { + } + + /** Represents an EndInteraction. */ + class EndInteraction implements IEndInteraction { + + /** + * Constructs a new EndInteraction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction); + + /** + * Creates a new EndInteraction instance using the specified properties. + * @param [properties] Properties to set + * @returns EndInteraction instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction; + + /** + * Encodes the specified EndInteraction message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @param message EndInteraction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EndInteraction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @param message EndInteraction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EndInteraction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EndInteraction + * @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.ResponseMessage.EndInteraction; + + /** + * Decodes an EndInteraction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EndInteraction + * @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.ResponseMessage.EndInteraction; + + /** + * Verifies an EndInteraction 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 EndInteraction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EndInteraction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction; + + /** + * Creates a plain object from an EndInteraction message. Also converts values to other types if specified. + * @param message EndInteraction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EndInteraction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PlayAudio. */ + interface IPlayAudio { + + /** PlayAudio audioUri */ + audioUri?: (string|null); + + /** PlayAudio allowPlaybackInterruption */ + allowPlaybackInterruption?: (boolean|null); + } + + /** Represents a PlayAudio. */ + class PlayAudio implements IPlayAudio { + + /** + * Constructs a new PlayAudio. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio); + + /** PlayAudio audioUri. */ + public audioUri: string; + + /** PlayAudio allowPlaybackInterruption. */ + public allowPlaybackInterruption: boolean; + + /** + * Creates a new PlayAudio instance using the specified properties. + * @param [properties] Properties to set + * @returns PlayAudio instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio; + + /** + * Encodes the specified PlayAudio message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.verify|verify} messages. + * @param message PlayAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PlayAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.verify|verify} messages. + * @param message PlayAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PlayAudio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PlayAudio + * @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.ResponseMessage.PlayAudio; + + /** + * Decodes a PlayAudio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PlayAudio + * @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.ResponseMessage.PlayAudio; + + /** + * Verifies a PlayAudio 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 a PlayAudio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PlayAudio + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio; + + /** + * Creates a plain object from a PlayAudio message. Also converts values to other types if specified. + * @param message PlayAudio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PlayAudio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SpeechWordInfo. */ + interface ISpeechWordInfo { + + /** SpeechWordInfo word */ + word?: (string|null); + + /** SpeechWordInfo startOffset */ + startOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo endOffset */ + endOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo confidence */ + confidence?: (number|null); + } + + /** Represents a SpeechWordInfo. */ + class SpeechWordInfo implements ISpeechWordInfo { + + /** + * Constructs a new SpeechWordInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo); + + /** SpeechWordInfo word. */ + public word: string; + + /** SpeechWordInfo startOffset. */ + public startOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo endOffset. */ + public endOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo confidence. */ + public confidence: number; + + /** + * Creates a new SpeechWordInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechWordInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo): google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo; + + /** + * Encodes the specified SpeechWordInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.verify|verify} messages. + * @param message SpeechWordInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechWordInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.verify|verify} messages. + * @param message SpeechWordInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechWordInfo + * @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.SpeechWordInfo; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechWordInfo + * @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.SpeechWordInfo; + + /** + * Verifies a SpeechWordInfo 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 a SpeechWordInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechWordInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo; + + /** + * Creates a plain object from a SpeechWordInfo message. Also converts values to other types if specified. + * @param message SpeechWordInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechWordInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + + /** Properties of an InputAudioConfig. */ + interface IInputAudioConfig { + + /** InputAudioConfig audioEncoding */ + audioEncoding?: (google.cloud.dialogflow.cx.v3beta1.AudioEncoding|keyof typeof google.cloud.dialogflow.cx.v3beta1.AudioEncoding|null); + + /** InputAudioConfig sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** InputAudioConfig enableWordInfo */ + enableWordInfo?: (boolean|null); + + /** InputAudioConfig phraseHints */ + phraseHints?: (string[]|null); + + /** InputAudioConfig model */ + model?: (string|null); + + /** InputAudioConfig modelVariant */ + modelVariant?: (google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant|keyof typeof google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant|null); + + /** InputAudioConfig singleUtterance */ + singleUtterance?: (boolean|null); + } + + /** Represents an InputAudioConfig. */ + class InputAudioConfig implements IInputAudioConfig { + + /** + * Constructs a new InputAudioConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig); + + /** InputAudioConfig audioEncoding. */ + public audioEncoding: (google.cloud.dialogflow.cx.v3beta1.AudioEncoding|keyof typeof google.cloud.dialogflow.cx.v3beta1.AudioEncoding); + + /** InputAudioConfig sampleRateHertz. */ + public sampleRateHertz: number; + + /** InputAudioConfig enableWordInfo. */ + public enableWordInfo: boolean; + + /** InputAudioConfig phraseHints. */ + public phraseHints: string[]; + + /** InputAudioConfig model. */ + public model: string; + + /** InputAudioConfig modelVariant. */ + public modelVariant: (google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant|keyof typeof google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant); + + /** InputAudioConfig singleUtterance. */ + public singleUtterance: boolean; + + /** + * Creates a new InputAudioConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputAudioConfig instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig): google.cloud.dialogflow.cx.v3beta1.InputAudioConfig; + + /** + * Encodes the specified InputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.verify|verify} messages. + * @param message InputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.verify|verify} messages. + * @param message InputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputAudioConfig + * @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.InputAudioConfig; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputAudioConfig + * @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.InputAudioConfig; + + /** + * Verifies an InputAudioConfig 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 InputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputAudioConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.InputAudioConfig; + + /** + * Creates a plain object from an InputAudioConfig message. Also converts values to other types if specified. + * @param message InputAudioConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.InputAudioConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputAudioConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** SpeechModelVariant enum. */ + enum SpeechModelVariant { + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0, + USE_BEST_AVAILABLE = 1, + USE_STANDARD = 2, + USE_ENHANCED = 3 + } + + /** Properties of a VoiceSelectionParams. */ + interface IVoiceSelectionParams { + + /** VoiceSelectionParams name */ + name?: (string|null); + + /** VoiceSelectionParams ssmlGender */ + ssmlGender?: (google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender|keyof typeof google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender|null); + } + + /** Represents a VoiceSelectionParams. */ + class VoiceSelectionParams implements IVoiceSelectionParams { + + /** + * Constructs a new VoiceSelectionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams); + + /** VoiceSelectionParams name. */ + public name: string; + + /** VoiceSelectionParams ssmlGender. */ + public ssmlGender: (google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender|keyof typeof google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender); + + /** + * Creates a new VoiceSelectionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns VoiceSelectionParams instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams): google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams; + + /** + * Encodes the specified VoiceSelectionParams message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.verify|verify} messages. + * @param message VoiceSelectionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VoiceSelectionParams message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.verify|verify} messages. + * @param message VoiceSelectionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VoiceSelectionParams + * @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.VoiceSelectionParams; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VoiceSelectionParams + * @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.VoiceSelectionParams; + + /** + * Verifies a VoiceSelectionParams 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 a VoiceSelectionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VoiceSelectionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams; + + /** + * Creates a plain object from a VoiceSelectionParams message. Also converts values to other types if specified. + * @param message VoiceSelectionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VoiceSelectionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SynthesizeSpeechConfig. */ + interface ISynthesizeSpeechConfig { + + /** SynthesizeSpeechConfig speakingRate */ + speakingRate?: (number|null); + + /** SynthesizeSpeechConfig pitch */ + pitch?: (number|null); + + /** SynthesizeSpeechConfig volumeGainDb */ + volumeGainDb?: (number|null); + + /** SynthesizeSpeechConfig effectsProfileId */ + effectsProfileId?: (string[]|null); + + /** SynthesizeSpeechConfig voice */ + voice?: (google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams|null); + } + + /** Represents a SynthesizeSpeechConfig. */ + class SynthesizeSpeechConfig implements ISynthesizeSpeechConfig { + + /** + * Constructs a new SynthesizeSpeechConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig); + + /** SynthesizeSpeechConfig speakingRate. */ + public speakingRate: number; + + /** SynthesizeSpeechConfig pitch. */ + public pitch: number; + + /** SynthesizeSpeechConfig volumeGainDb. */ + public volumeGainDb: number; + + /** SynthesizeSpeechConfig effectsProfileId. */ + public effectsProfileId: string[]; + + /** SynthesizeSpeechConfig voice. */ + public voice?: (google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams|null); + + /** + * Creates a new SynthesizeSpeechConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SynthesizeSpeechConfig instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig): google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig; + + /** + * Encodes the specified SynthesizeSpeechConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @param message SynthesizeSpeechConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SynthesizeSpeechConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @param message SynthesizeSpeechConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SynthesizeSpeechConfig + * @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.SynthesizeSpeechConfig; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SynthesizeSpeechConfig + * @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.SynthesizeSpeechConfig; + + /** + * Verifies a SynthesizeSpeechConfig 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 a SynthesizeSpeechConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SynthesizeSpeechConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig; + + /** + * Creates a plain object from a SynthesizeSpeechConfig message. Also converts values to other types if specified. + * @param message SynthesizeSpeechConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SynthesizeSpeechConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** SsmlVoiceGender enum. */ + enum SsmlVoiceGender { + SSML_VOICE_GENDER_UNSPECIFIED = 0, + SSML_VOICE_GENDER_MALE = 1, + SSML_VOICE_GENDER_FEMALE = 2, + SSML_VOICE_GENDER_NEUTRAL = 3 + } + + /** Properties of an OutputAudioConfig. */ + interface IOutputAudioConfig { + + /** OutputAudioConfig audioEncoding */ + audioEncoding?: (google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding|null); + + /** OutputAudioConfig sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** OutputAudioConfig synthesizeSpeechConfig */ + synthesizeSpeechConfig?: (google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig|null); + } + + /** Represents an OutputAudioConfig. */ + class OutputAudioConfig implements IOutputAudioConfig { + + /** + * Constructs a new OutputAudioConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig); + + /** OutputAudioConfig audioEncoding. */ + public audioEncoding: (google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding); + + /** OutputAudioConfig sampleRateHertz. */ + public sampleRateHertz: number; + + /** OutputAudioConfig synthesizeSpeechConfig. */ + public synthesizeSpeechConfig?: (google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig|null); + + /** + * Creates a new OutputAudioConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputAudioConfig instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig): google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig; + + /** + * Encodes the specified OutputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify|verify} messages. + * @param message OutputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify|verify} messages. + * @param message OutputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputAudioConfig + * @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.OutputAudioConfig; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputAudioConfig + * @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.OutputAudioConfig; + + /** + * Verifies an OutputAudioConfig 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 OutputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputAudioConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig; + + /** + * Creates a plain object from an OutputAudioConfig message. Also converts values to other types if specified. + * @param message OutputAudioConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputAudioConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** OutputAudioEncoding enum. */ + enum OutputAudioEncoding { + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0, + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1, + OUTPUT_AUDIO_ENCODING_MP3 = 2, + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4, + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3, + OUTPUT_AUDIO_ENCODING_MULAW = 5 + } + + /** Represents an EntityTypes */ + class EntityTypes extends $protobuf.rpc.Service { + + /** + * Constructs a new EntityTypes service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new EntityTypes service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): EntityTypes; + + /** + * Calls ListEntityTypes. + * @param request ListEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEntityTypesResponse + */ + public listEntityTypes(request: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, callback: google.cloud.dialogflow.cx.v3beta1.EntityTypes.ListEntityTypesCallback): void; + + /** + * Calls ListEntityTypes. + * @param request ListEntityTypesRequest message or plain object + * @returns Promise + */ + public listEntityTypes(request: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest): Promise; + + /** + * Calls GetEntityType. + * @param request GetEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public getEntityType(request: google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.EntityTypes.GetEntityTypeCallback): void; + + /** + * Calls GetEntityType. + * @param request GetEntityTypeRequest message or plain object + * @returns Promise + */ + public getEntityType(request: google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest): Promise; + + /** + * Calls CreateEntityType. + * @param request CreateEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public createEntityType(request: google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.EntityTypes.CreateEntityTypeCallback): void; + + /** + * Calls CreateEntityType. + * @param request CreateEntityTypeRequest message or plain object + * @returns Promise + */ + public createEntityType(request: google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest): Promise; + + /** + * Calls UpdateEntityType. + * @param request UpdateEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public updateEntityType(request: google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.EntityTypes.UpdateEntityTypeCallback): void; + + /** + * Calls UpdateEntityType. + * @param request UpdateEntityTypeRequest message or plain object + * @returns Promise + */ + public updateEntityType(request: google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest): Promise; + + /** + * Calls DeleteEntityType. + * @param request DeleteEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteEntityType(request: google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.EntityTypes.DeleteEntityTypeCallback): void; + + /** + * Calls DeleteEntityType. + * @param request DeleteEntityTypeRequest message or plain object + * @returns Promise + */ + public deleteEntityType(request: google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest): Promise; + } + + namespace EntityTypes { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#listEntityTypes}. + * @param error Error, if any + * @param [response] ListEntityTypesResponse + */ + type ListEntityTypesCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#getEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type GetEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#createEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type CreateEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#updateEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type UpdateEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#deleteEntityType}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteEntityTypeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType name */ + name?: (string|null); + + /** EntityType displayName */ + displayName?: (string|null); + + /** EntityType kind */ + kind?: (google.cloud.dialogflow.cx.v3beta1.EntityType.Kind|keyof typeof google.cloud.dialogflow.cx.v3beta1.EntityType.Kind|null); + + /** EntityType autoExpansionMode */ + autoExpansionMode?: (google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode|keyof typeof google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode|null); + + /** EntityType entities */ + entities?: (google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity[]|null); + + /** EntityType excludedPhrases */ + excludedPhrases?: (google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase[]|null); + + /** EntityType enableFuzzyExtraction */ + enableFuzzyExtraction?: (boolean|null); + } + + /** Represents an EntityType. */ + class EntityType implements IEntityType { + + /** + * Constructs a new EntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IEntityType); + + /** EntityType name. */ + public name: string; + + /** EntityType displayName. */ + public displayName: string; + + /** EntityType kind. */ + public kind: (google.cloud.dialogflow.cx.v3beta1.EntityType.Kind|keyof typeof google.cloud.dialogflow.cx.v3beta1.EntityType.Kind); + + /** EntityType autoExpansionMode. */ + public autoExpansionMode: (google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode|keyof typeof google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode); + + /** EntityType entities. */ + public entities: google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity[]; + + /** EntityType excludedPhrases. */ + public excludedPhrases: google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase[]; + + /** EntityType enableFuzzyExtraction. */ + public enableFuzzyExtraction: boolean; + + /** + * Creates a new EntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityType instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IEntityType): google.cloud.dialogflow.cx.v3beta1.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityType + * @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.EntityType; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityType + * @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.EntityType; + + /** + * Verifies an EntityType 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 EntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.EntityType; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @param message EntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EntityType { + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity value */ + value?: (string|null); + + /** Entity synonyms */ + synonyms?: (string[]|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity); + + /** Entity value. */ + public value: string; + + /** Entity synonyms. */ + public synonyms: string[]; + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity): google.cloud.dialogflow.cx.v3beta1.EntityType.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @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.EntityType.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @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.EntityType.Entity; + + /** + * Verifies an Entity 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.EntityType.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.EntityType.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExcludedPhrase. */ + interface IExcludedPhrase { + + /** ExcludedPhrase value */ + value?: (string|null); + } + + /** Represents an ExcludedPhrase. */ + class ExcludedPhrase implements IExcludedPhrase { + + /** + * Constructs a new ExcludedPhrase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase); + + /** ExcludedPhrase value. */ + public value: string; + + /** + * Creates a new ExcludedPhrase instance using the specified properties. + * @param [properties] Properties to set + * @returns ExcludedPhrase instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase): google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase; + + /** + * Encodes the specified ExcludedPhrase message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.verify|verify} messages. + * @param message ExcludedPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExcludedPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.verify|verify} messages. + * @param message ExcludedPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExcludedPhrase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExcludedPhrase + * @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.EntityType.ExcludedPhrase; + + /** + * Decodes an ExcludedPhrase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExcludedPhrase + * @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.EntityType.ExcludedPhrase; + + /** + * Verifies an ExcludedPhrase 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 ExcludedPhrase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExcludedPhrase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase; + + /** + * Creates a plain object from an ExcludedPhrase message. Also converts values to other types if specified. + * @param message ExcludedPhrase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExcludedPhrase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Kind enum. */ + enum Kind { + KIND_UNSPECIFIED = 0, + KIND_MAP = 1, + KIND_LIST = 2, + KIND_REGEXP = 3 + } + + /** AutoExpansionMode enum. */ + enum AutoExpansionMode { + AUTO_EXPANSION_MODE_UNSPECIFIED = 0, + AUTO_EXPANSION_MODE_DEFAULT = 1 + } + } + + /** Properties of a ListEntityTypesRequest. */ + interface IListEntityTypesRequest { + + /** ListEntityTypesRequest parent */ + parent?: (string|null); + + /** ListEntityTypesRequest languageCode */ + languageCode?: (string|null); + + /** ListEntityTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListEntityTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEntityTypesRequest. */ + class ListEntityTypesRequest implements IListEntityTypesRequest { + + /** + * Constructs a new ListEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest); + + /** ListEntityTypesRequest parent. */ + public parent: string; + + /** ListEntityTypesRequest languageCode. */ + public languageCode: string; + + /** ListEntityTypesRequest pageSize. */ + public pageSize: number; + + /** ListEntityTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest): google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest; + + /** + * Encodes the specified ListEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest.verify|verify} messages. + * @param message ListEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest.verify|verify} messages. + * @param message ListEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEntityTypesRequest + * @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.ListEntityTypesRequest; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEntityTypesRequest + * @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.ListEntityTypesRequest; + + /** + * Verifies a ListEntityTypesRequest 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 a ListEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest; + + /** + * Creates a plain object from a ListEntityTypesRequest message. Also converts values to other types if specified. + * @param message ListEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListEntityTypesResponse. */ + interface IListEntityTypesResponse { + + /** ListEntityTypesResponse entityTypes */ + entityTypes?: (google.cloud.dialogflow.cx.v3beta1.IEntityType[]|null); + + /** ListEntityTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEntityTypesResponse. */ + class ListEntityTypesResponse implements IListEntityTypesResponse { + + /** + * Constructs a new ListEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse); + + /** ListEntityTypesResponse entityTypes. */ + public entityTypes: google.cloud.dialogflow.cx.v3beta1.IEntityType[]; + + /** ListEntityTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse): google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse; + + /** + * Encodes the specified ListEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse.verify|verify} messages. + * @param message ListEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse.verify|verify} messages. + * @param message ListEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEntityTypesResponse + * @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.ListEntityTypesResponse; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEntityTypesResponse + * @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.ListEntityTypesResponse; + + /** + * Verifies a ListEntityTypesResponse 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 a ListEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse; + + /** + * Creates a plain object from a ListEntityTypesResponse message. Also converts values to other types if specified. + * @param message ListEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetEntityTypeRequest. */ + interface IGetEntityTypeRequest { + + /** GetEntityTypeRequest name */ + name?: (string|null); + + /** GetEntityTypeRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetEntityTypeRequest. */ + class GetEntityTypeRequest implements IGetEntityTypeRequest { + + /** + * Constructs a new GetEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest); + + /** GetEntityTypeRequest name. */ + public name: string; + + /** GetEntityTypeRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest; + + /** + * Encodes the specified GetEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest.verify|verify} messages. + * @param message GetEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest.verify|verify} messages. + * @param message GetEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEntityTypeRequest + * @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.GetEntityTypeRequest; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEntityTypeRequest + * @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.GetEntityTypeRequest; + + /** + * Verifies a GetEntityTypeRequest 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 a GetEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest; + + /** + * Creates a plain object from a GetEntityTypeRequest message. Also converts values to other types if specified. + * @param message GetEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateEntityTypeRequest. */ + interface ICreateEntityTypeRequest { + + /** CreateEntityTypeRequest parent */ + parent?: (string|null); + + /** CreateEntityTypeRequest entityType */ + entityType?: (google.cloud.dialogflow.cx.v3beta1.IEntityType|null); + + /** CreateEntityTypeRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreateEntityTypeRequest. */ + class CreateEntityTypeRequest implements ICreateEntityTypeRequest { + + /** + * Constructs a new CreateEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest); + + /** CreateEntityTypeRequest parent. */ + public parent: string; + + /** CreateEntityTypeRequest entityType. */ + public entityType?: (google.cloud.dialogflow.cx.v3beta1.IEntityType|null); + + /** CreateEntityTypeRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreateEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest; + + /** + * Encodes the specified CreateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest.verify|verify} messages. + * @param message CreateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest.verify|verify} messages. + * @param message CreateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEntityTypeRequest + * @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.CreateEntityTypeRequest; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEntityTypeRequest + * @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.CreateEntityTypeRequest; + + /** + * Verifies a CreateEntityTypeRequest 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 a CreateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest; + + /** + * Creates a plain object from a CreateEntityTypeRequest message. Also converts values to other types if specified. + * @param message CreateEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateEntityTypeRequest. */ + interface IUpdateEntityTypeRequest { + + /** UpdateEntityTypeRequest entityType */ + entityType?: (google.cloud.dialogflow.cx.v3beta1.IEntityType|null); + + /** UpdateEntityTypeRequest languageCode */ + languageCode?: (string|null); + + /** UpdateEntityTypeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateEntityTypeRequest. */ + class UpdateEntityTypeRequest implements IUpdateEntityTypeRequest { + + /** + * Constructs a new UpdateEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest); + + /** UpdateEntityTypeRequest entityType. */ + public entityType?: (google.cloud.dialogflow.cx.v3beta1.IEntityType|null); + + /** UpdateEntityTypeRequest languageCode. */ + public languageCode: string; + + /** UpdateEntityTypeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest; + + /** + * Encodes the specified UpdateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @param message UpdateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @param message UpdateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEntityTypeRequest + * @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.UpdateEntityTypeRequest; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEntityTypeRequest + * @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.UpdateEntityTypeRequest; + + /** + * Verifies an UpdateEntityTypeRequest 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 UpdateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest; + + /** + * Creates a plain object from an UpdateEntityTypeRequest message. Also converts values to other types if specified. + * @param message UpdateEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteEntityTypeRequest. */ + interface IDeleteEntityTypeRequest { + + /** DeleteEntityTypeRequest name */ + name?: (string|null); + + /** DeleteEntityTypeRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteEntityTypeRequest. */ + class DeleteEntityTypeRequest implements IDeleteEntityTypeRequest { + + /** + * Constructs a new DeleteEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest); + + /** DeleteEntityTypeRequest name. */ + public name: string; + + /** DeleteEntityTypeRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest; + + /** + * Encodes the specified DeleteEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @param message DeleteEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @param message DeleteEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteEntityTypeRequest + * @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.DeleteEntityTypeRequest; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteEntityTypeRequest + * @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.DeleteEntityTypeRequest; + + /** + * Verifies a DeleteEntityTypeRequest 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 a DeleteEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest; + + /** + * Creates a plain object from a DeleteEntityTypeRequest message. Also converts values to other types if specified. + * @param message DeleteEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents an Environments */ + class Environments extends $protobuf.rpc.Service { + + /** + * Constructs a new Environments service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Environments service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Environments; + + /** + * Calls ListEnvironments. + * @param request ListEnvironmentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEnvironmentsResponse + */ + public listEnvironments(request: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, callback: google.cloud.dialogflow.cx.v3beta1.Environments.ListEnvironmentsCallback): void; + + /** + * Calls ListEnvironments. + * @param request ListEnvironmentsRequest message or plain object + * @returns Promise + */ + public listEnvironments(request: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest): Promise; + + /** + * Calls GetEnvironment. + * @param request GetEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public getEnvironment(request: google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Environments.GetEnvironmentCallback): void; + + /** + * Calls GetEnvironment. + * @param request GetEnvironmentRequest message or plain object + * @returns Promise + */ + public getEnvironment(request: google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest): Promise; + + /** + * Calls CreateEnvironment. + * @param request CreateEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createEnvironment(request: google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Environments.CreateEnvironmentCallback): void; + + /** + * Calls CreateEnvironment. + * @param request CreateEnvironmentRequest message or plain object + * @returns Promise + */ + public createEnvironment(request: google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest): Promise; + + /** + * Calls UpdateEnvironment. + * @param request UpdateEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateEnvironment(request: google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Environments.UpdateEnvironmentCallback): void; + + /** + * Calls UpdateEnvironment. + * @param request UpdateEnvironmentRequest message or plain object + * @returns Promise + */ + public updateEnvironment(request: google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest): Promise; + + /** + * Calls DeleteEnvironment. + * @param request DeleteEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteEnvironment(request: google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Environments.DeleteEnvironmentCallback): void; + + /** + * Calls DeleteEnvironment. + * @param request DeleteEnvironmentRequest message or plain object + * @returns Promise + */ + public deleteEnvironment(request: google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest): Promise; + + /** + * Calls LookupEnvironmentHistory. + * @param request LookupEnvironmentHistoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and LookupEnvironmentHistoryResponse + */ + public lookupEnvironmentHistory(request: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, callback: google.cloud.dialogflow.cx.v3beta1.Environments.LookupEnvironmentHistoryCallback): void; + + /** + * Calls LookupEnvironmentHistory. + * @param request LookupEnvironmentHistoryRequest message or plain object + * @returns Promise + */ + public lookupEnvironmentHistory(request: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest): Promise; + } + + namespace Environments { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#listEnvironments}. + * @param error Error, if any + * @param [response] ListEnvironmentsResponse + */ + type ListEnvironmentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#getEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type GetEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#createEnvironment}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateEnvironmentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#updateEnvironment}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateEnvironmentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#deleteEnvironment}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteEnvironmentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#lookupEnvironmentHistory}. + * @param error Error, if any + * @param [response] LookupEnvironmentHistoryResponse + */ + type LookupEnvironmentHistoryCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse) => void; + } + + /** Properties of an Environment. */ + interface IEnvironment { + + /** Environment name */ + name?: (string|null); + + /** Environment displayName */ + displayName?: (string|null); + + /** Environment description */ + description?: (string|null); + + /** Environment versionConfigs */ + versionConfigs?: (google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig[]|null); + + /** Environment updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an Environment. */ + class Environment implements IEnvironment { + + /** + * Constructs a new Environment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IEnvironment); + + /** Environment name. */ + public name: string; + + /** Environment displayName. */ + public displayName: string; + + /** Environment description. */ + public description: string; + + /** Environment versionConfigs. */ + public versionConfigs: google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig[]; + + /** Environment updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Environment instance using the specified properties. + * @param [properties] Properties to set + * @returns Environment instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IEnvironment): google.cloud.dialogflow.cx.v3beta1.Environment; + + /** + * Encodes the specified Environment message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.verify|verify} messages. + * @param message Environment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IEnvironment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.verify|verify} messages. + * @param message Environment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IEnvironment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Environment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Environment + * @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.Environment; + + /** + * Decodes an Environment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Environment + * @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.Environment; + + /** + * Verifies an Environment 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 Environment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Environment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Environment; + + /** + * Creates a plain object from an Environment message. Also converts values to other types if specified. + * @param message Environment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Environment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Environment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Environment { + + /** Properties of a VersionConfig. */ + interface IVersionConfig { + + /** VersionConfig version */ + version?: (string|null); + } + + /** Represents a VersionConfig. */ + class VersionConfig implements IVersionConfig { + + /** + * Constructs a new VersionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig); + + /** VersionConfig version. */ + public version: string; + + /** + * Creates a new VersionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns VersionConfig instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig): google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig; + + /** + * Encodes the specified VersionConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.verify|verify} messages. + * @param message VersionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VersionConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.verify|verify} messages. + * @param message VersionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VersionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VersionConfig + * @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.Environment.VersionConfig; + + /** + * Decodes a VersionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VersionConfig + * @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.Environment.VersionConfig; + + /** + * Verifies a VersionConfig 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 a VersionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VersionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig; + + /** + * Creates a plain object from a VersionConfig message. Also converts values to other types if specified. + * @param message VersionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VersionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ListEnvironmentsRequest. */ + interface IListEnvironmentsRequest { + + /** ListEnvironmentsRequest parent */ + parent?: (string|null); + + /** ListEnvironmentsRequest pageSize */ + pageSize?: (number|null); + + /** ListEnvironmentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEnvironmentsRequest. */ + class ListEnvironmentsRequest implements IListEnvironmentsRequest { + + /** + * Constructs a new ListEnvironmentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest); + + /** ListEnvironmentsRequest parent. */ + public parent: string; + + /** ListEnvironmentsRequest pageSize. */ + public pageSize: number; + + /** ListEnvironmentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEnvironmentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEnvironmentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest): google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest; + + /** + * Encodes the specified ListEnvironmentsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest.verify|verify} messages. + * @param message ListEnvironmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEnvironmentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest.verify|verify} messages. + * @param message ListEnvironmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEnvironmentsRequest + * @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.ListEnvironmentsRequest; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEnvironmentsRequest + * @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.ListEnvironmentsRequest; + + /** + * Verifies a ListEnvironmentsRequest 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 a ListEnvironmentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEnvironmentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest; + + /** + * Creates a plain object from a ListEnvironmentsRequest message. Also converts values to other types if specified. + * @param message ListEnvironmentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEnvironmentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListEnvironmentsResponse. */ + interface IListEnvironmentsResponse { + + /** ListEnvironmentsResponse environments */ + environments?: (google.cloud.dialogflow.cx.v3beta1.IEnvironment[]|null); + + /** ListEnvironmentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEnvironmentsResponse. */ + class ListEnvironmentsResponse implements IListEnvironmentsResponse { + + /** + * Constructs a new ListEnvironmentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse); + + /** ListEnvironmentsResponse environments. */ + public environments: google.cloud.dialogflow.cx.v3beta1.IEnvironment[]; + + /** ListEnvironmentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEnvironmentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEnvironmentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse): google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse; + + /** + * Encodes the specified ListEnvironmentsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse.verify|verify} messages. + * @param message ListEnvironmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEnvironmentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse.verify|verify} messages. + * @param message ListEnvironmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEnvironmentsResponse + * @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.ListEnvironmentsResponse; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEnvironmentsResponse + * @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.ListEnvironmentsResponse; + + /** + * Verifies a ListEnvironmentsResponse 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 a ListEnvironmentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEnvironmentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse; + + /** + * Creates a plain object from a ListEnvironmentsResponse message. Also converts values to other types if specified. + * @param message ListEnvironmentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEnvironmentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetEnvironmentRequest. */ + interface IGetEnvironmentRequest { + + /** GetEnvironmentRequest name */ + name?: (string|null); + } + + /** Represents a GetEnvironmentRequest. */ + class GetEnvironmentRequest implements IGetEnvironmentRequest { + + /** + * Constructs a new GetEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest); + + /** GetEnvironmentRequest name. */ + public name: string; + + /** + * Creates a new GetEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest): google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest; + + /** + * Encodes the specified GetEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest.verify|verify} messages. + * @param message GetEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest.verify|verify} messages. + * @param message GetEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEnvironmentRequest + * @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.GetEnvironmentRequest; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEnvironmentRequest + * @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.GetEnvironmentRequest; + + /** + * Verifies a GetEnvironmentRequest 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 a GetEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest; + + /** + * Creates a plain object from a GetEnvironmentRequest message. Also converts values to other types if specified. + * @param message GetEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateEnvironmentRequest. */ + interface ICreateEnvironmentRequest { + + /** CreateEnvironmentRequest parent */ + parent?: (string|null); + + /** CreateEnvironmentRequest environment */ + environment?: (google.cloud.dialogflow.cx.v3beta1.IEnvironment|null); + } + + /** Represents a CreateEnvironmentRequest. */ + class CreateEnvironmentRequest implements ICreateEnvironmentRequest { + + /** + * Constructs a new CreateEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest); + + /** CreateEnvironmentRequest parent. */ + public parent: string; + + /** CreateEnvironmentRequest environment. */ + public environment?: (google.cloud.dialogflow.cx.v3beta1.IEnvironment|null); + + /** + * Creates a new CreateEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest): google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest; + + /** + * Encodes the specified CreateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest.verify|verify} messages. + * @param message CreateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest.verify|verify} messages. + * @param message CreateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEnvironmentRequest + * @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.CreateEnvironmentRequest; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEnvironmentRequest + * @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.CreateEnvironmentRequest; + + /** + * Verifies a CreateEnvironmentRequest 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 a CreateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest; + + /** + * Creates a plain object from a CreateEnvironmentRequest message. Also converts values to other types if specified. + * @param message CreateEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateEnvironmentRequest. */ + interface IUpdateEnvironmentRequest { + + /** UpdateEnvironmentRequest environment */ + environment?: (google.cloud.dialogflow.cx.v3beta1.IEnvironment|null); + + /** UpdateEnvironmentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateEnvironmentRequest. */ + class UpdateEnvironmentRequest implements IUpdateEnvironmentRequest { + + /** + * Constructs a new UpdateEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest); + + /** UpdateEnvironmentRequest environment. */ + public environment?: (google.cloud.dialogflow.cx.v3beta1.IEnvironment|null); + + /** UpdateEnvironmentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest): google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest; + + /** + * Encodes the specified UpdateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @param message UpdateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @param message UpdateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEnvironmentRequest + * @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.UpdateEnvironmentRequest; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEnvironmentRequest + * @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.UpdateEnvironmentRequest; + + /** + * Verifies an UpdateEnvironmentRequest 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 UpdateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest; + + /** + * Creates a plain object from an UpdateEnvironmentRequest message. Also converts values to other types if specified. + * @param message UpdateEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteEnvironmentRequest. */ + interface IDeleteEnvironmentRequest { + + /** DeleteEnvironmentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteEnvironmentRequest. */ + class DeleteEnvironmentRequest implements IDeleteEnvironmentRequest { + + /** + * Constructs a new DeleteEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest); + + /** DeleteEnvironmentRequest name. */ + public name: string; + + /** + * Creates a new DeleteEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest): google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest; + + /** + * Encodes the specified DeleteEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @param message DeleteEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @param message DeleteEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteEnvironmentRequest + * @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.DeleteEnvironmentRequest; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteEnvironmentRequest + * @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.DeleteEnvironmentRequest; + + /** + * Verifies a DeleteEnvironmentRequest 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 a DeleteEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest; + + /** + * Creates a plain object from a DeleteEnvironmentRequest message. Also converts values to other types if specified. + * @param message DeleteEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LookupEnvironmentHistoryRequest. */ + interface ILookupEnvironmentHistoryRequest { + + /** LookupEnvironmentHistoryRequest name */ + name?: (string|null); + + /** LookupEnvironmentHistoryRequest pageSize */ + pageSize?: (number|null); + + /** LookupEnvironmentHistoryRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a LookupEnvironmentHistoryRequest. */ + class LookupEnvironmentHistoryRequest implements ILookupEnvironmentHistoryRequest { + + /** + * Constructs a new LookupEnvironmentHistoryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest); + + /** LookupEnvironmentHistoryRequest name. */ + public name: string; + + /** LookupEnvironmentHistoryRequest pageSize. */ + public pageSize: number; + + /** LookupEnvironmentHistoryRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new LookupEnvironmentHistoryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns LookupEnvironmentHistoryRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest): google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest; + + /** + * Encodes the specified LookupEnvironmentHistoryRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest.verify|verify} messages. + * @param message LookupEnvironmentHistoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LookupEnvironmentHistoryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest.verify|verify} messages. + * @param message LookupEnvironmentHistoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LookupEnvironmentHistoryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LookupEnvironmentHistoryRequest + * @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.LookupEnvironmentHistoryRequest; + + /** + * Decodes a LookupEnvironmentHistoryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LookupEnvironmentHistoryRequest + * @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.LookupEnvironmentHistoryRequest; + + /** + * Verifies a LookupEnvironmentHistoryRequest 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 a LookupEnvironmentHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LookupEnvironmentHistoryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest; + + /** + * Creates a plain object from a LookupEnvironmentHistoryRequest message. Also converts values to other types if specified. + * @param message LookupEnvironmentHistoryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LookupEnvironmentHistoryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LookupEnvironmentHistoryResponse. */ + interface ILookupEnvironmentHistoryResponse { + + /** LookupEnvironmentHistoryResponse environments */ + environments?: (google.cloud.dialogflow.cx.v3beta1.IEnvironment[]|null); + + /** LookupEnvironmentHistoryResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a LookupEnvironmentHistoryResponse. */ + class LookupEnvironmentHistoryResponse implements ILookupEnvironmentHistoryResponse { + + /** + * Constructs a new LookupEnvironmentHistoryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse); + + /** LookupEnvironmentHistoryResponse environments. */ + public environments: google.cloud.dialogflow.cx.v3beta1.IEnvironment[]; + + /** LookupEnvironmentHistoryResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new LookupEnvironmentHistoryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns LookupEnvironmentHistoryResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse): google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse; + + /** + * Encodes the specified LookupEnvironmentHistoryResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse.verify|verify} messages. + * @param message LookupEnvironmentHistoryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LookupEnvironmentHistoryResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse.verify|verify} messages. + * @param message LookupEnvironmentHistoryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LookupEnvironmentHistoryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LookupEnvironmentHistoryResponse + * @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.LookupEnvironmentHistoryResponse; + + /** + * Decodes a LookupEnvironmentHistoryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LookupEnvironmentHistoryResponse + * @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.LookupEnvironmentHistoryResponse; + + /** + * Verifies a LookupEnvironmentHistoryResponse 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 a LookupEnvironmentHistoryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LookupEnvironmentHistoryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse; + + /** + * Creates a plain object from a LookupEnvironmentHistoryResponse message. Also converts values to other types if specified. + * @param message LookupEnvironmentHistoryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LookupEnvironmentHistoryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents an Intents */ + class Intents extends $protobuf.rpc.Service { + + /** + * Constructs a new Intents service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Intents service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Intents; + + /** + * Calls ListIntents. + * @param request ListIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListIntentsResponse + */ + public listIntents(request: google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, callback: google.cloud.dialogflow.cx.v3beta1.Intents.ListIntentsCallback): void; + + /** + * Calls ListIntents. + * @param request ListIntentsRequest message or plain object + * @returns Promise + */ + public listIntents(request: google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest): Promise; + + /** + * Calls GetIntent. + * @param request GetIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public getIntent(request: google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Intents.GetIntentCallback): void; + + /** + * Calls GetIntent. + * @param request GetIntentRequest message or plain object + * @returns Promise + */ + public getIntent(request: google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest): Promise; + + /** + * Calls CreateIntent. + * @param request CreateIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public createIntent(request: google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntentCallback): void; + + /** + * Calls CreateIntent. + * @param request CreateIntentRequest message or plain object + * @returns Promise + */ + public createIntent(request: google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest): Promise; + + /** + * Calls UpdateIntent. + * @param request UpdateIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public updateIntent(request: google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntentCallback): void; + + /** + * Calls UpdateIntent. + * @param request UpdateIntentRequest message or plain object + * @returns Promise + */ + public updateIntent(request: google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest): Promise; + + /** + * Calls DeleteIntent. + * @param request DeleteIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteIntent(request: google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Intents.DeleteIntentCallback): void; + + /** + * Calls DeleteIntent. + * @param request DeleteIntentRequest message or plain object + * @returns Promise + */ + public deleteIntent(request: google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest): Promise; + } + + namespace Intents { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#listIntents}. + * @param error Error, if any + * @param [response] ListIntentsResponse + */ + type ListIntentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#getIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type GetIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#createIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type CreateIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#updateIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type UpdateIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#deleteIntent}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteIntentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of an Intent. */ + interface IIntent { + + /** Intent name */ + name?: (string|null); + + /** Intent displayName */ + displayName?: (string|null); + + /** Intent trainingPhrases */ + trainingPhrases?: (google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase[]|null); + + /** Intent parameters */ + parameters?: (google.cloud.dialogflow.cx.v3beta1.Intent.IParameter[]|null); + + /** Intent priority */ + priority?: (number|null); + + /** Intent isFallback */ + isFallback?: (boolean|null); + + /** Intent labels */ + labels?: ({ [k: string]: string }|null); + + /** Intent description */ + description?: (string|null); + } + + /** Represents an Intent. */ + class Intent implements IIntent { + + /** + * Constructs a new Intent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IIntent); + + /** Intent name. */ + public name: string; + + /** Intent displayName. */ + public displayName: string; + + /** Intent trainingPhrases. */ + public trainingPhrases: google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase[]; + + /** Intent parameters. */ + public parameters: google.cloud.dialogflow.cx.v3beta1.Intent.IParameter[]; + + /** Intent priority. */ + public priority: number; + + /** Intent isFallback. */ + public isFallback: boolean; + + /** Intent labels. */ + public labels: { [k: string]: string }; + + /** Intent description. */ + public description: string; + + /** + * Creates a new Intent instance using the specified properties. + * @param [properties] Properties to set + * @returns Intent instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IIntent): google.cloud.dialogflow.cx.v3beta1.Intent; + + /** + * Encodes the specified Intent message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.verify|verify} messages. + * @param message Intent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IIntent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Intent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.verify|verify} messages. + * @param message Intent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IIntent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Intent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Intent + * @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.Intent; + + /** + * Decodes an Intent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Intent + * @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.Intent; + + /** + * Verifies an Intent 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 Intent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Intent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Intent; + + /** + * Creates a plain object from an Intent message. Also converts values to other types if specified. + * @param message Intent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Intent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Intent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Intent { + + /** Properties of a TrainingPhrase. */ + interface ITrainingPhrase { + + /** TrainingPhrase id */ + id?: (string|null); + + /** TrainingPhrase parts */ + parts?: (google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart[]|null); + + /** TrainingPhrase repeatCount */ + repeatCount?: (number|null); + } + + /** Represents a TrainingPhrase. */ + class TrainingPhrase implements ITrainingPhrase { + + /** + * Constructs a new TrainingPhrase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase); + + /** TrainingPhrase id. */ + public id: string; + + /** TrainingPhrase parts. */ + public parts: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart[]; + + /** TrainingPhrase repeatCount. */ + public repeatCount: number; + + /** + * Creates a new TrainingPhrase instance using the specified properties. + * @param [properties] Properties to set + * @returns TrainingPhrase instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase): google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase; + + /** + * Encodes the specified TrainingPhrase message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.verify|verify} messages. + * @param message TrainingPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TrainingPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.verify|verify} messages. + * @param message TrainingPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TrainingPhrase + * @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.Intent.TrainingPhrase; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TrainingPhrase + * @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.Intent.TrainingPhrase; + + /** + * Verifies a TrainingPhrase 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 a TrainingPhrase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TrainingPhrase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase; + + /** + * Creates a plain object from a TrainingPhrase message. Also converts values to other types if specified. + * @param message TrainingPhrase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TrainingPhrase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TrainingPhrase { + + /** Properties of a Part. */ + interface IPart { + + /** Part text */ + text?: (string|null); + + /** Part parameterId */ + parameterId?: (string|null); + } + + /** Represents a Part. */ + class Part implements IPart { + + /** + * Constructs a new Part. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart); + + /** Part text. */ + public text: string; + + /** Part parameterId. */ + public parameterId: string; + + /** + * Creates a new Part instance using the specified properties. + * @param [properties] Properties to set + * @returns Part instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart): google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part; + + /** + * Encodes the specified Part message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @param message Part message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @param message Part message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Part message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Part + * @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.Intent.TrainingPhrase.Part; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Part + * @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.Intent.TrainingPhrase.Part; + + /** + * Verifies a Part 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 a Part message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Part + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @param message Part + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Part to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Parameter. */ + interface IParameter { + + /** Parameter id */ + id?: (string|null); + + /** Parameter entityType */ + entityType?: (string|null); + + /** Parameter isList */ + isList?: (boolean|null); + + /** Parameter redact */ + redact?: (boolean|null); + } + + /** Represents a Parameter. */ + class Parameter implements IParameter { + + /** + * Constructs a new Parameter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Intent.IParameter); + + /** Parameter id. */ + public id: string; + + /** Parameter entityType. */ + public entityType: string; + + /** Parameter isList. */ + public isList: boolean; + + /** Parameter redact. */ + public redact: boolean; + + /** + * Creates a new Parameter instance using the specified properties. + * @param [properties] Properties to set + * @returns Parameter instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Intent.IParameter): google.cloud.dialogflow.cx.v3beta1.Intent.Parameter; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Intent.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Intent.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Parameter + * @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.Intent.Parameter; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Parameter + * @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.Intent.Parameter; + + /** + * Verifies a Parameter 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 a Parameter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Parameter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Intent.Parameter; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @param message Parameter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Intent.Parameter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Parameter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ListIntentsRequest. */ + interface IListIntentsRequest { + + /** ListIntentsRequest parent */ + parent?: (string|null); + + /** ListIntentsRequest languageCode */ + languageCode?: (string|null); + + /** ListIntentsRequest intentView */ + intentView?: (google.cloud.dialogflow.cx.v3beta1.IntentView|keyof typeof google.cloud.dialogflow.cx.v3beta1.IntentView|null); + + /** ListIntentsRequest pageSize */ + pageSize?: (number|null); + + /** ListIntentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListIntentsRequest. */ + class ListIntentsRequest implements IListIntentsRequest { + + /** + * Constructs a new ListIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest); + + /** ListIntentsRequest parent. */ + public parent: string; + + /** ListIntentsRequest languageCode. */ + public languageCode: string; + + /** ListIntentsRequest intentView. */ + public intentView: (google.cloud.dialogflow.cx.v3beta1.IntentView|keyof typeof google.cloud.dialogflow.cx.v3beta1.IntentView); + + /** ListIntentsRequest pageSize. */ + public pageSize: number; + + /** ListIntentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest): google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest; + + /** + * Encodes the specified ListIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest.verify|verify} messages. + * @param message ListIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest.verify|verify} messages. + * @param message ListIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIntentsRequest + * @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.ListIntentsRequest; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIntentsRequest + * @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.ListIntentsRequest; + + /** + * Verifies a ListIntentsRequest 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 a ListIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest; + + /** + * Creates a plain object from a ListIntentsRequest message. Also converts values to other types if specified. + * @param message ListIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListIntentsResponse. */ + interface IListIntentsResponse { + + /** ListIntentsResponse intents */ + intents?: (google.cloud.dialogflow.cx.v3beta1.IIntent[]|null); + + /** ListIntentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListIntentsResponse. */ + class ListIntentsResponse implements IListIntentsResponse { + + /** + * Constructs a new ListIntentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse); + + /** ListIntentsResponse intents. */ + public intents: google.cloud.dialogflow.cx.v3beta1.IIntent[]; + + /** ListIntentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListIntentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIntentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse): google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse; + + /** + * Encodes the specified ListIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse.verify|verify} messages. + * @param message ListIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse.verify|verify} messages. + * @param message ListIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIntentsResponse + * @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.ListIntentsResponse; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIntentsResponse + * @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.ListIntentsResponse; + + /** + * Verifies a ListIntentsResponse 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 a ListIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIntentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse; + + /** + * Creates a plain object from a ListIntentsResponse message. Also converts values to other types if specified. + * @param message ListIntentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIntentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetIntentRequest. */ + interface IGetIntentRequest { + + /** GetIntentRequest name */ + name?: (string|null); + + /** GetIntentRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetIntentRequest. */ + class GetIntentRequest implements IGetIntentRequest { + + /** + * Constructs a new GetIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest); + + /** GetIntentRequest name. */ + public name: string; + + /** GetIntentRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest): google.cloud.dialogflow.cx.v3beta1.GetIntentRequest; + + /** + * Encodes the specified GetIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetIntentRequest.verify|verify} messages. + * @param message GetIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetIntentRequest.verify|verify} messages. + * @param message GetIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetIntentRequest + * @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.GetIntentRequest; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetIntentRequest + * @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.GetIntentRequest; + + /** + * Verifies a GetIntentRequest 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 a GetIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetIntentRequest; + + /** + * Creates a plain object from a GetIntentRequest message. Also converts values to other types if specified. + * @param message GetIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateIntentRequest. */ + interface ICreateIntentRequest { + + /** CreateIntentRequest parent */ + parent?: (string|null); + + /** CreateIntentRequest intent */ + intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** CreateIntentRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreateIntentRequest. */ + class CreateIntentRequest implements ICreateIntentRequest { + + /** + * Constructs a new CreateIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest); + + /** CreateIntentRequest parent. */ + public parent: string; + + /** CreateIntentRequest intent. */ + public intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** CreateIntentRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreateIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest): google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest; + + /** + * Encodes the specified CreateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest.verify|verify} messages. + * @param message CreateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest.verify|verify} messages. + * @param message CreateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateIntentRequest + * @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.CreateIntentRequest; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateIntentRequest + * @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.CreateIntentRequest; + + /** + * Verifies a CreateIntentRequest 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 a CreateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest; + + /** + * Creates a plain object from a CreateIntentRequest message. Also converts values to other types if specified. + * @param message CreateIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateIntentRequest. */ + interface IUpdateIntentRequest { + + /** UpdateIntentRequest intent */ + intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** UpdateIntentRequest languageCode */ + languageCode?: (string|null); + + /** UpdateIntentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateIntentRequest. */ + class UpdateIntentRequest implements IUpdateIntentRequest { + + /** + * Constructs a new UpdateIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest); + + /** UpdateIntentRequest intent. */ + public intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** UpdateIntentRequest languageCode. */ + public languageCode: string; + + /** UpdateIntentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest): google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest; + + /** + * Encodes the specified UpdateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest.verify|verify} messages. + * @param message UpdateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest.verify|verify} messages. + * @param message UpdateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateIntentRequest + * @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.UpdateIntentRequest; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateIntentRequest + * @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.UpdateIntentRequest; + + /** + * Verifies an UpdateIntentRequest 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 UpdateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest; + + /** + * Creates a plain object from an UpdateIntentRequest message. Also converts values to other types if specified. + * @param message UpdateIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteIntentRequest. */ + interface IDeleteIntentRequest { + + /** DeleteIntentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteIntentRequest. */ + class DeleteIntentRequest implements IDeleteIntentRequest { + + /** + * Constructs a new DeleteIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest); + + /** DeleteIntentRequest name. */ + public name: string; + + /** + * Creates a new DeleteIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest): google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest; + + /** + * Encodes the specified DeleteIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest.verify|verify} messages. + * @param message DeleteIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest.verify|verify} messages. + * @param message DeleteIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteIntentRequest + * @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.DeleteIntentRequest; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteIntentRequest + * @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.DeleteIntentRequest; + + /** + * Verifies a DeleteIntentRequest 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 a DeleteIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest; + + /** + * Creates a plain object from a DeleteIntentRequest message. Also converts values to other types if specified. + * @param message DeleteIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** IntentView enum. */ + enum IntentView { + INTENT_VIEW_UNSPECIFIED = 0, + INTENT_VIEW_PARTIAL = 1, + INTENT_VIEW_FULL = 2 + } + + /** Represents a Sessions */ + class Sessions extends $protobuf.rpc.Service { + + /** + * Constructs a new Sessions service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Sessions service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Sessions; + + /** + * Calls DetectIntent. + * @param request DetectIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DetectIntentResponse + */ + public detectIntent(request: google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntentCallback): void; + + /** + * Calls DetectIntent. + * @param request DetectIntentRequest message or plain object + * @returns Promise + */ + public detectIntent(request: google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest): Promise; + + /** + * Calls StreamingDetectIntent. + * @param request StreamingDetectIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingDetectIntentResponse + */ + public streamingDetectIntent(request: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntentCallback): void; + + /** + * Calls StreamingDetectIntent. + * @param request StreamingDetectIntentRequest message or plain object + * @returns Promise + */ + public streamingDetectIntent(request: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest): Promise; + + /** + * Calls MatchIntent. + * @param request MatchIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MatchIntentResponse + */ + public matchIntent(request: google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntentCallback): void; + + /** + * Calls MatchIntent. + * @param request MatchIntentRequest message or plain object + * @returns Promise + */ + public matchIntent(request: google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest): Promise; + + /** + * Calls FulfillIntent. + * @param request FulfillIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FulfillIntentResponse + */ + public fulfillIntent(request: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, callback: google.cloud.dialogflow.cx.v3beta1.Sessions.FulfillIntentCallback): void; + + /** + * Calls FulfillIntent. + * @param request FulfillIntentRequest message or plain object + * @returns Promise + */ + public fulfillIntent(request: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest): Promise; + } + + namespace Sessions { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#detectIntent}. + * @param error Error, if any + * @param [response] DetectIntentResponse + */ + type DetectIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#streamingDetectIntent}. + * @param error Error, if any + * @param [response] StreamingDetectIntentResponse + */ + type StreamingDetectIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#matchIntent}. + * @param error Error, if any + * @param [response] MatchIntentResponse + */ + type MatchIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#fulfillIntent}. + * @param error Error, if any + * @param [response] FulfillIntentResponse + */ + type FulfillIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse) => void; + } + + /** Properties of a DetectIntentRequest. */ + interface IDetectIntentRequest { + + /** DetectIntentRequest session */ + session?: (string|null); + + /** DetectIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null); + + /** DetectIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.cx.v3beta1.IQueryInput|null); + + /** DetectIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + } + + /** Represents a DetectIntentRequest. */ + class DetectIntentRequest implements IDetectIntentRequest { + + /** + * Constructs a new DetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest); + + /** DetectIntentRequest session. */ + public session: string; + + /** DetectIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null); + + /** DetectIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.cx.v3beta1.IQueryInput|null); + + /** DetectIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + + /** + * Creates a new DetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest): google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest; + + /** + * Encodes the specified DetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.verify|verify} messages. + * @param message DetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.verify|verify} messages. + * @param message DetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectIntentRequest + * @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.DetectIntentRequest; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectIntentRequest + * @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.DetectIntentRequest; + + /** + * Verifies a DetectIntentRequest 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 a DetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest; + + /** + * Creates a plain object from a DetectIntentRequest message. Also converts values to other types if specified. + * @param message DetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DetectIntentResponse. */ + interface IDetectIntentResponse { + + /** DetectIntentResponse responseId */ + responseId?: (string|null); + + /** DetectIntentResponse queryResult */ + queryResult?: (google.cloud.dialogflow.cx.v3beta1.IQueryResult|null); + + /** DetectIntentResponse outputAudio */ + outputAudio?: (Uint8Array|string|null); + + /** DetectIntentResponse outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + } + + /** Represents a DetectIntentResponse. */ + class DetectIntentResponse implements IDetectIntentResponse { + + /** + * Constructs a new DetectIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse); + + /** DetectIntentResponse responseId. */ + public responseId: string; + + /** DetectIntentResponse queryResult. */ + public queryResult?: (google.cloud.dialogflow.cx.v3beta1.IQueryResult|null); + + /** DetectIntentResponse outputAudio. */ + public outputAudio: (Uint8Array|string); + + /** DetectIntentResponse outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + + /** + * Creates a new DetectIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse): google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse; + + /** + * Encodes the specified DetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.verify|verify} messages. + * @param message DetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.verify|verify} messages. + * @param message DetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectIntentResponse + * @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.DetectIntentResponse; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectIntentResponse + * @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.DetectIntentResponse; + + /** + * Verifies a DetectIntentResponse 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 a DetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse; + + /** + * Creates a plain object from a DetectIntentResponse message. Also converts values to other types if specified. + * @param message DetectIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StreamingDetectIntentRequest. */ + interface IStreamingDetectIntentRequest { + + /** StreamingDetectIntentRequest session */ + session?: (string|null); + + /** StreamingDetectIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null); + + /** StreamingDetectIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.cx.v3beta1.IQueryInput|null); + + /** StreamingDetectIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + } + + /** Represents a StreamingDetectIntentRequest. */ + class StreamingDetectIntentRequest implements IStreamingDetectIntentRequest { + + /** + * Constructs a new StreamingDetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest); + + /** StreamingDetectIntentRequest session. */ + public session: string; + + /** StreamingDetectIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null); + + /** StreamingDetectIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.cx.v3beta1.IQueryInput|null); + + /** StreamingDetectIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + + /** + * Creates a new StreamingDetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingDetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest): google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest; + + /** + * Encodes the specified StreamingDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @param message StreamingDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @param message StreamingDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingDetectIntentRequest + * @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.StreamingDetectIntentRequest; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingDetectIntentRequest + * @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.StreamingDetectIntentRequest; + + /** + * Verifies a StreamingDetectIntentRequest 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 a StreamingDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingDetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest; + + /** + * Creates a plain object from a StreamingDetectIntentRequest message. Also converts values to other types if specified. + * @param message StreamingDetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingDetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StreamingDetectIntentResponse. */ + interface IStreamingDetectIntentResponse { + + /** StreamingDetectIntentResponse recognitionResult */ + recognitionResult?: (google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult|null); + + /** StreamingDetectIntentResponse detectIntentResponse */ + detectIntentResponse?: (google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse|null); + } + + /** Represents a StreamingDetectIntentResponse. */ + class StreamingDetectIntentResponse implements IStreamingDetectIntentResponse { + + /** + * Constructs a new StreamingDetectIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse); + + /** StreamingDetectIntentResponse recognitionResult. */ + public recognitionResult?: (google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult|null); + + /** StreamingDetectIntentResponse detectIntentResponse. */ + public detectIntentResponse?: (google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse|null); + + /** StreamingDetectIntentResponse response. */ + public response?: ("recognitionResult"|"detectIntentResponse"); + + /** + * Creates a new StreamingDetectIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingDetectIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse): google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse; + + /** + * Encodes the specified StreamingDetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @param message StreamingDetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingDetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @param message StreamingDetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingDetectIntentResponse + * @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.StreamingDetectIntentResponse; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingDetectIntentResponse + * @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.StreamingDetectIntentResponse; + + /** + * Verifies a StreamingDetectIntentResponse 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 a StreamingDetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingDetectIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse; + + /** + * Creates a plain object from a StreamingDetectIntentResponse message. Also converts values to other types if specified. + * @param message StreamingDetectIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingDetectIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StreamingRecognitionResult. */ + interface IStreamingRecognitionResult { + + /** StreamingRecognitionResult messageType */ + messageType?: (google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType|keyof typeof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType|null); + + /** StreamingRecognitionResult transcript */ + transcript?: (string|null); + + /** StreamingRecognitionResult isFinal */ + isFinal?: (boolean|null); + + /** StreamingRecognitionResult confidence */ + confidence?: (number|null); + + /** StreamingRecognitionResult stability */ + stability?: (number|null); + + /** StreamingRecognitionResult speechWordInfo */ + speechWordInfo?: (google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo[]|null); + + /** StreamingRecognitionResult speechEndOffset */ + speechEndOffset?: (google.protobuf.IDuration|null); + } + + /** Represents a StreamingRecognitionResult. */ + class StreamingRecognitionResult implements IStreamingRecognitionResult { + + /** + * Constructs a new StreamingRecognitionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult); + + /** StreamingRecognitionResult messageType. */ + public messageType: (google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType|keyof typeof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType); + + /** StreamingRecognitionResult transcript. */ + public transcript: string; + + /** StreamingRecognitionResult isFinal. */ + public isFinal: boolean; + + /** StreamingRecognitionResult confidence. */ + public confidence: number; + + /** StreamingRecognitionResult stability. */ + public stability: number; + + /** StreamingRecognitionResult speechWordInfo. */ + public speechWordInfo: google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo[]; + + /** StreamingRecognitionResult speechEndOffset. */ + public speechEndOffset?: (google.protobuf.IDuration|null); + + /** + * Creates a new StreamingRecognitionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRecognitionResult instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult): google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult; + + /** + * Encodes the specified StreamingRecognitionResult message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.verify|verify} messages. + * @param message StreamingRecognitionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.verify|verify} messages. + * @param message StreamingRecognitionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRecognitionResult + * @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.StreamingRecognitionResult; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRecognitionResult + * @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.StreamingRecognitionResult; + + /** + * Verifies a StreamingRecognitionResult 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 a StreamingRecognitionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRecognitionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult; + + /** + * Creates a plain object from a StreamingRecognitionResult message. Also converts values to other types if specified. + * @param message StreamingRecognitionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRecognitionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace StreamingRecognitionResult { + + /** MessageType enum. */ + enum MessageType { + MESSAGE_TYPE_UNSPECIFIED = 0, + TRANSCRIPT = 1, + END_OF_SINGLE_UTTERANCE = 2 + } + } + + /** Properties of a QueryParameters. */ + interface IQueryParameters { + + /** QueryParameters timeZone */ + timeZone?: (string|null); + + /** QueryParameters geoLocation */ + geoLocation?: (google.type.ILatLng|null); + + /** QueryParameters sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[]|null); + + /** QueryParameters payload */ + payload?: (google.protobuf.IStruct|null); + + /** QueryParameters parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** QueryParameters analyzeQueryTextSentiment */ + analyzeQueryTextSentiment?: (boolean|null); + } + + /** Represents a QueryParameters. */ + class QueryParameters implements IQueryParameters { + + /** + * Constructs a new QueryParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IQueryParameters); + + /** QueryParameters timeZone. */ + public timeZone: string; + + /** QueryParameters geoLocation. */ + public geoLocation?: (google.type.ILatLng|null); + + /** QueryParameters sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[]; + + /** QueryParameters payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** QueryParameters parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** QueryParameters analyzeQueryTextSentiment. */ + public analyzeQueryTextSentiment: boolean; + + /** + * Creates a new QueryParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryParameters instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IQueryParameters): google.cloud.dialogflow.cx.v3beta1.QueryParameters; + + /** + * Encodes the specified QueryParameters message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify|verify} messages. + * @param message QueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify|verify} messages. + * @param message QueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryParameters + * @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.QueryParameters; + + /** + * Decodes a QueryParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryParameters + * @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.QueryParameters; + + /** + * Verifies a QueryParameters 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 a QueryParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.QueryParameters; + + /** + * Creates a plain object from a QueryParameters message. Also converts values to other types if specified. + * @param message QueryParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.QueryParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a QueryInput. */ + interface IQueryInput { + + /** QueryInput text */ + text?: (google.cloud.dialogflow.cx.v3beta1.ITextInput|null); + + /** QueryInput intent */ + intent?: (google.cloud.dialogflow.cx.v3beta1.IIntentInput|null); + + /** QueryInput audio */ + audio?: (google.cloud.dialogflow.cx.v3beta1.IAudioInput|null); + + /** QueryInput event */ + event?: (google.cloud.dialogflow.cx.v3beta1.IEventInput|null); + + /** QueryInput dtmf */ + dtmf?: (google.cloud.dialogflow.cx.v3beta1.IDtmfInput|null); + + /** QueryInput languageCode */ + languageCode?: (string|null); + } + + /** Represents a QueryInput. */ + class QueryInput implements IQueryInput { + + /** + * Constructs a new QueryInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IQueryInput); + + /** QueryInput text. */ + public text?: (google.cloud.dialogflow.cx.v3beta1.ITextInput|null); + + /** QueryInput intent. */ + public intent?: (google.cloud.dialogflow.cx.v3beta1.IIntentInput|null); + + /** QueryInput audio. */ + public audio?: (google.cloud.dialogflow.cx.v3beta1.IAudioInput|null); + + /** QueryInput event. */ + public event?: (google.cloud.dialogflow.cx.v3beta1.IEventInput|null); + + /** QueryInput dtmf. */ + public dtmf?: (google.cloud.dialogflow.cx.v3beta1.IDtmfInput|null); + + /** QueryInput languageCode. */ + public languageCode: string; + + /** QueryInput input. */ + public input?: ("text"|"intent"|"audio"|"event"|"dtmf"); + + /** + * Creates a new QueryInput instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryInput instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IQueryInput): google.cloud.dialogflow.cx.v3beta1.QueryInput; + + /** + * Encodes the specified QueryInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryInput.verify|verify} messages. + * @param message QueryInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IQueryInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryInput.verify|verify} messages. + * @param message QueryInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IQueryInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryInput + * @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.QueryInput; + + /** + * Decodes a QueryInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryInput + * @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.QueryInput; + + /** + * Verifies a QueryInput 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 a QueryInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.QueryInput; + + /** + * Creates a plain object from a QueryInput message. Also converts values to other types if specified. + * @param message QueryInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.QueryInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a QueryResult. */ + interface IQueryResult { + + /** QueryResult text */ + text?: (string|null); + + /** QueryResult triggerIntent */ + triggerIntent?: (string|null); + + /** QueryResult transcript */ + transcript?: (string|null); + + /** QueryResult triggerEvent */ + triggerEvent?: (string|null); + + /** QueryResult languageCode */ + languageCode?: (string|null); + + /** QueryResult parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** QueryResult responseMessages */ + responseMessages?: (google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]|null); + + /** QueryResult webhookStatuses */ + webhookStatuses?: (google.rpc.IStatus[]|null); + + /** QueryResult webhookPayloads */ + webhookPayloads?: (google.protobuf.IStruct[]|null); + + /** QueryResult currentPage */ + currentPage?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** QueryResult intent */ + intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** QueryResult intentDetectionConfidence */ + intentDetectionConfidence?: (number|null); + + /** QueryResult match */ + match?: (google.cloud.dialogflow.cx.v3beta1.IMatch|null); + + /** QueryResult diagnosticInfo */ + diagnosticInfo?: (google.protobuf.IStruct|null); + + /** QueryResult sentimentAnalysisResult */ + sentimentAnalysisResult?: (google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult|null); + } + + /** Represents a QueryResult. */ + class QueryResult implements IQueryResult { + + /** + * Constructs a new QueryResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IQueryResult); + + /** QueryResult text. */ + public text: string; + + /** QueryResult triggerIntent. */ + public triggerIntent: string; + + /** QueryResult transcript. */ + public transcript: string; + + /** QueryResult triggerEvent. */ + public triggerEvent: string; + + /** QueryResult languageCode. */ + public languageCode: string; + + /** QueryResult parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** QueryResult responseMessages. */ + public responseMessages: google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]; + + /** QueryResult webhookStatuses. */ + public webhookStatuses: google.rpc.IStatus[]; + + /** QueryResult webhookPayloads. */ + public webhookPayloads: google.protobuf.IStruct[]; + + /** QueryResult currentPage. */ + public currentPage?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** QueryResult intent. */ + public intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** QueryResult intentDetectionConfidence. */ + public intentDetectionConfidence: number; + + /** QueryResult match. */ + public match?: (google.cloud.dialogflow.cx.v3beta1.IMatch|null); + + /** QueryResult diagnosticInfo. */ + public diagnosticInfo?: (google.protobuf.IStruct|null); + + /** QueryResult sentimentAnalysisResult. */ + public sentimentAnalysisResult?: (google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult|null); + + /** QueryResult query. */ + public query?: ("text"|"triggerIntent"|"transcript"|"triggerEvent"); + + /** + * Creates a new QueryResult instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryResult instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IQueryResult): google.cloud.dialogflow.cx.v3beta1.QueryResult; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryResult + * @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.QueryResult; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryResult + * @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.QueryResult; + + /** + * Verifies a QueryResult 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 a QueryResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.QueryResult; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @param message QueryResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TextInput. */ + interface ITextInput { + + /** TextInput text */ + text?: (string|null); + } + + /** Represents a TextInput. */ + class TextInput implements ITextInput { + + /** + * Constructs a new TextInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ITextInput); + + /** TextInput text. */ + public text: string; + + /** + * Creates a new TextInput instance using the specified properties. + * @param [properties] Properties to set + * @returns TextInput instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ITextInput): google.cloud.dialogflow.cx.v3beta1.TextInput; + + /** + * Encodes the specified TextInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TextInput.verify|verify} messages. + * @param message TextInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ITextInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TextInput.verify|verify} messages. + * @param message TextInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ITextInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextInput + * @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.TextInput; + + /** + * Decodes a TextInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextInput + * @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.TextInput; + + /** + * Verifies a TextInput 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 a TextInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.TextInput; + + /** + * Creates a plain object from a TextInput message. Also converts values to other types if specified. + * @param message TextInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.TextInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an IntentInput. */ + interface IIntentInput { + + /** IntentInput intent */ + intent?: (string|null); + } + + /** Represents an IntentInput. */ + class IntentInput implements IIntentInput { + + /** + * Constructs a new IntentInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IIntentInput); + + /** IntentInput intent. */ + public intent: string; + + /** + * Creates a new IntentInput instance using the specified properties. + * @param [properties] Properties to set + * @returns IntentInput instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IIntentInput): google.cloud.dialogflow.cx.v3beta1.IntentInput; + + /** + * Encodes the specified IntentInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.IntentInput.verify|verify} messages. + * @param message IntentInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IIntentInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IntentInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.IntentInput.verify|verify} messages. + * @param message IntentInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IIntentInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IntentInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IntentInput + * @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.IntentInput; + + /** + * Decodes an IntentInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IntentInput + * @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.IntentInput; + + /** + * Verifies an IntentInput 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 IntentInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IntentInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.IntentInput; + + /** + * Creates a plain object from an IntentInput message. Also converts values to other types if specified. + * @param message IntentInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.IntentInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IntentInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AudioInput. */ + interface IAudioInput { + + /** AudioInput config */ + config?: (google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig|null); + + /** AudioInput audio */ + audio?: (Uint8Array|string|null); + } + + /** Represents an AudioInput. */ + class AudioInput implements IAudioInput { + + /** + * Constructs a new AudioInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IAudioInput); + + /** AudioInput config. */ + public config?: (google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig|null); + + /** AudioInput audio. */ + public audio: (Uint8Array|string); + + /** + * Creates a new AudioInput instance using the specified properties. + * @param [properties] Properties to set + * @returns AudioInput instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IAudioInput): google.cloud.dialogflow.cx.v3beta1.AudioInput; + + /** + * Encodes the specified AudioInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.AudioInput.verify|verify} messages. + * @param message AudioInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IAudioInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AudioInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.AudioInput.verify|verify} messages. + * @param message AudioInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IAudioInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AudioInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AudioInput + * @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.AudioInput; + + /** + * Decodes an AudioInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AudioInput + * @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.AudioInput; + + /** + * Verifies an AudioInput 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 AudioInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AudioInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.AudioInput; + + /** + * Creates a plain object from an AudioInput message. Also converts values to other types if specified. + * @param message AudioInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.AudioInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AudioInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EventInput. */ + interface IEventInput { + + /** EventInput event */ + event?: (string|null); + } + + /** Represents an EventInput. */ + class EventInput implements IEventInput { + + /** + * Constructs a new EventInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IEventInput); + + /** EventInput event. */ + public event: string; + + /** + * Creates a new EventInput instance using the specified properties. + * @param [properties] Properties to set + * @returns EventInput instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IEventInput): google.cloud.dialogflow.cx.v3beta1.EventInput; + + /** + * Encodes the specified EventInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventInput.verify|verify} messages. + * @param message EventInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IEventInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventInput.verify|verify} messages. + * @param message EventInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IEventInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventInput + * @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.EventInput; + + /** + * Decodes an EventInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventInput + * @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.EventInput; + + /** + * Verifies an EventInput 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 EventInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.EventInput; + + /** + * Creates a plain object from an EventInput message. Also converts values to other types if specified. + * @param message EventInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.EventInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DtmfInput. */ + interface IDtmfInput { + + /** DtmfInput digits */ + digits?: (string|null); + + /** DtmfInput finishDigit */ + finishDigit?: (string|null); + } + + /** Represents a DtmfInput. */ + class DtmfInput implements IDtmfInput { + + /** + * Constructs a new DtmfInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDtmfInput); + + /** DtmfInput digits. */ + public digits: string; + + /** DtmfInput finishDigit. */ + public finishDigit: string; + + /** + * Creates a new DtmfInput instance using the specified properties. + * @param [properties] Properties to set + * @returns DtmfInput instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDtmfInput): google.cloud.dialogflow.cx.v3beta1.DtmfInput; + + /** + * Encodes the specified DtmfInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DtmfInput.verify|verify} messages. + * @param message DtmfInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDtmfInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DtmfInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DtmfInput.verify|verify} messages. + * @param message DtmfInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDtmfInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DtmfInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DtmfInput + * @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.DtmfInput; + + /** + * Decodes a DtmfInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DtmfInput + * @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.DtmfInput; + + /** + * Verifies a DtmfInput 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 a DtmfInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DtmfInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DtmfInput; + + /** + * Creates a plain object from a DtmfInput message. Also converts values to other types if specified. + * @param message DtmfInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DtmfInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DtmfInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Match. */ + interface IMatch { + + /** Match intent */ + intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** Match event */ + event?: (string|null); + + /** Match parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** Match resolvedInput */ + resolvedInput?: (string|null); + + /** Match matchType */ + matchType?: (google.cloud.dialogflow.cx.v3beta1.Match.MatchType|keyof typeof google.cloud.dialogflow.cx.v3beta1.Match.MatchType|null); + + /** Match confidence */ + confidence?: (number|null); + } + + /** Represents a Match. */ + class Match implements IMatch { + + /** + * Constructs a new Match. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IMatch); + + /** Match intent. */ + public intent?: (google.cloud.dialogflow.cx.v3beta1.IIntent|null); + + /** Match event. */ + public event: string; + + /** Match parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** Match resolvedInput. */ + public resolvedInput: string; + + /** Match matchType. */ + public matchType: (google.cloud.dialogflow.cx.v3beta1.Match.MatchType|keyof typeof google.cloud.dialogflow.cx.v3beta1.Match.MatchType); + + /** Match confidence. */ + public confidence: number; + + /** + * Creates a new Match instance using the specified properties. + * @param [properties] Properties to set + * @returns Match instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IMatch): google.cloud.dialogflow.cx.v3beta1.Match; + + /** + * Encodes the specified Match message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Match.verify|verify} messages. + * @param message Match message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IMatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Match message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Match.verify|verify} messages. + * @param message Match message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IMatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Match message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Match + * @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.Match; + + /** + * Decodes a Match message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Match + * @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.Match; + + /** + * Verifies a Match 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 a Match message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Match + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Match; + + /** + * Creates a plain object from a Match message. Also converts values to other types if specified. + * @param message Match + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Match, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Match to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Match { + + /** MatchType enum. */ + enum MatchType { + MATCH_TYPE_UNSPECIFIED = 0, + INTENT = 1, + DIRECT_INTENT = 2, + PARAMETER_FILLING = 3, + NO_MATCH = 4, + NO_INPUT = 5, + EVENT = 6 + } + } + + /** Properties of a MatchIntentRequest. */ + interface IMatchIntentRequest { + + /** MatchIntentRequest session */ + session?: (string|null); + + /** MatchIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null); + + /** MatchIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.cx.v3beta1.IQueryInput|null); + } + + /** Represents a MatchIntentRequest. */ + class MatchIntentRequest implements IMatchIntentRequest { + + /** + * Constructs a new MatchIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest); + + /** MatchIntentRequest session. */ + public session: string; + + /** MatchIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null); + + /** MatchIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.cx.v3beta1.IQueryInput|null); + + /** + * Creates a new MatchIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns MatchIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest): google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest; + + /** + * Encodes the specified MatchIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.verify|verify} messages. + * @param message MatchIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MatchIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.verify|verify} messages. + * @param message MatchIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MatchIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MatchIntentRequest + * @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.MatchIntentRequest; + + /** + * Decodes a MatchIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MatchIntentRequest + * @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.MatchIntentRequest; + + /** + * Verifies a MatchIntentRequest 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 a MatchIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MatchIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest; + + /** + * Creates a plain object from a MatchIntentRequest message. Also converts values to other types if specified. + * @param message MatchIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MatchIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MatchIntentResponse. */ + interface IMatchIntentResponse { + + /** MatchIntentResponse text */ + text?: (string|null); + + /** MatchIntentResponse triggerIntent */ + triggerIntent?: (string|null); + + /** MatchIntentResponse transcript */ + transcript?: (string|null); + + /** MatchIntentResponse triggerEvent */ + triggerEvent?: (string|null); + + /** MatchIntentResponse matches */ + matches?: (google.cloud.dialogflow.cx.v3beta1.IMatch[]|null); + + /** MatchIntentResponse currentPage */ + currentPage?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + } + + /** Represents a MatchIntentResponse. */ + class MatchIntentResponse implements IMatchIntentResponse { + + /** + * Constructs a new MatchIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse); + + /** MatchIntentResponse text. */ + public text: string; + + /** MatchIntentResponse triggerIntent. */ + public triggerIntent: string; + + /** MatchIntentResponse transcript. */ + public transcript: string; + + /** MatchIntentResponse triggerEvent. */ + public triggerEvent: string; + + /** MatchIntentResponse matches. */ + public matches: google.cloud.dialogflow.cx.v3beta1.IMatch[]; + + /** MatchIntentResponse currentPage. */ + public currentPage?: (google.cloud.dialogflow.cx.v3beta1.IPage|null); + + /** MatchIntentResponse query. */ + public query?: ("text"|"triggerIntent"|"transcript"|"triggerEvent"); + + /** + * Creates a new MatchIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns MatchIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse): google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse; + + /** + * Encodes the specified MatchIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.verify|verify} messages. + * @param message MatchIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MatchIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.verify|verify} messages. + * @param message MatchIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MatchIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MatchIntentResponse + * @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.MatchIntentResponse; + + /** + * Decodes a MatchIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MatchIntentResponse + * @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.MatchIntentResponse; + + /** + * Verifies a MatchIntentResponse 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 a MatchIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MatchIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse; + + /** + * Creates a plain object from a MatchIntentResponse message. Also converts values to other types if specified. + * @param message MatchIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MatchIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FulfillIntentRequest. */ + interface IFulfillIntentRequest { + + /** FulfillIntentRequest matchIntentRequest */ + matchIntentRequest?: (google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest|null); + + /** FulfillIntentRequest match */ + match?: (google.cloud.dialogflow.cx.v3beta1.IMatch|null); + + /** FulfillIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + } + + /** Represents a FulfillIntentRequest. */ + class FulfillIntentRequest implements IFulfillIntentRequest { + + /** + * Constructs a new FulfillIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest); + + /** FulfillIntentRequest matchIntentRequest. */ + public matchIntentRequest?: (google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest|null); + + /** FulfillIntentRequest match. */ + public match?: (google.cloud.dialogflow.cx.v3beta1.IMatch|null); + + /** FulfillIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + + /** + * Creates a new FulfillIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest): google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest; + + /** + * Encodes the specified FulfillIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.verify|verify} messages. + * @param message FulfillIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.verify|verify} messages. + * @param message FulfillIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillIntentRequest + * @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.FulfillIntentRequest; + + /** + * Decodes a FulfillIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillIntentRequest + * @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.FulfillIntentRequest; + + /** + * Verifies a FulfillIntentRequest 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 a FulfillIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest; + + /** + * Creates a plain object from a FulfillIntentRequest message. Also converts values to other types if specified. + * @param message FulfillIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FulfillIntentResponse. */ + interface IFulfillIntentResponse { + + /** FulfillIntentResponse responseId */ + responseId?: (string|null); + + /** FulfillIntentResponse queryResult */ + queryResult?: (google.cloud.dialogflow.cx.v3beta1.IQueryResult|null); + + /** FulfillIntentResponse outputAudio */ + outputAudio?: (Uint8Array|string|null); + + /** FulfillIntentResponse outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + } + + /** Represents a FulfillIntentResponse. */ + class FulfillIntentResponse implements IFulfillIntentResponse { + + /** + * Constructs a new FulfillIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse); + + /** FulfillIntentResponse responseId. */ + public responseId: string; + + /** FulfillIntentResponse queryResult. */ + public queryResult?: (google.cloud.dialogflow.cx.v3beta1.IQueryResult|null); + + /** FulfillIntentResponse outputAudio. */ + public outputAudio: (Uint8Array|string); + + /** FulfillIntentResponse outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null); + + /** + * Creates a new FulfillIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse): google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse; + + /** + * Encodes the specified FulfillIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse.verify|verify} messages. + * @param message FulfillIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse.verify|verify} messages. + * @param message FulfillIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillIntentResponse + * @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.FulfillIntentResponse; + + /** + * Decodes a FulfillIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillIntentResponse + * @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.FulfillIntentResponse; + + /** + * Verifies a FulfillIntentResponse 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 a FulfillIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse; + + /** + * Creates a plain object from a FulfillIntentResponse message. Also converts values to other types if specified. + * @param message FulfillIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SentimentAnalysisResult. */ + interface ISentimentAnalysisResult { + + /** SentimentAnalysisResult score */ + score?: (number|null); + + /** SentimentAnalysisResult magnitude */ + magnitude?: (number|null); + } + + /** Represents a SentimentAnalysisResult. */ + class SentimentAnalysisResult implements ISentimentAnalysisResult { + + /** + * Constructs a new SentimentAnalysisResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult); + + /** SentimentAnalysisResult score. */ + public score: number; + + /** SentimentAnalysisResult magnitude. */ + public magnitude: number; + + /** + * Creates a new SentimentAnalysisResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SentimentAnalysisResult instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult): google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult; + + /** + * Encodes the specified SentimentAnalysisResult message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.verify|verify} messages. + * @param message SentimentAnalysisResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SentimentAnalysisResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.verify|verify} messages. + * @param message SentimentAnalysisResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SentimentAnalysisResult + * @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.SentimentAnalysisResult; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SentimentAnalysisResult + * @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.SentimentAnalysisResult; + + /** + * Verifies a SentimentAnalysisResult 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 a SentimentAnalysisResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SentimentAnalysisResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult; + + /** + * Creates a plain object from a SentimentAnalysisResult message. Also converts values to other types if specified. + * @param message SentimentAnalysisResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SentimentAnalysisResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a SessionEntityTypes */ + class SessionEntityTypes extends $protobuf.rpc.Service { + + /** + * Constructs a new SessionEntityTypes service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SessionEntityTypes service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SessionEntityTypes; + + /** + * Calls ListSessionEntityTypes. + * @param request ListSessionEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSessionEntityTypesResponse + */ + public listSessionEntityTypes(request: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, callback: google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.ListSessionEntityTypesCallback): void; + + /** + * Calls ListSessionEntityTypes. + * @param request ListSessionEntityTypesRequest message or plain object + * @returns Promise + */ + public listSessionEntityTypes(request: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest): Promise; + + /** + * Calls GetSessionEntityType. + * @param request GetSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public getSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.GetSessionEntityTypeCallback): void; + + /** + * Calls GetSessionEntityType. + * @param request GetSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public getSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest): Promise; + + /** + * Calls CreateSessionEntityType. + * @param request CreateSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public createSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.CreateSessionEntityTypeCallback): void; + + /** + * Calls CreateSessionEntityType. + * @param request CreateSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public createSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest): Promise; + + /** + * Calls UpdateSessionEntityType. + * @param request UpdateSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public updateSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.UpdateSessionEntityTypeCallback): void; + + /** + * Calls UpdateSessionEntityType. + * @param request UpdateSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public updateSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest): Promise; + + /** + * Calls DeleteSessionEntityType. + * @param request DeleteSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, callback: google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.DeleteSessionEntityTypeCallback): void; + + /** + * Calls DeleteSessionEntityType. + * @param request DeleteSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public deleteSessionEntityType(request: google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest): Promise; + } + + namespace SessionEntityTypes { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#listSessionEntityTypes}. + * @param error Error, if any + * @param [response] ListSessionEntityTypesResponse + */ + type ListSessionEntityTypesCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#getSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type GetSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#createSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type CreateSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#updateSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type UpdateSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#deleteSessionEntityType}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteSessionEntityTypeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a SessionEntityType. */ + interface ISessionEntityType { + + /** SessionEntityType name */ + name?: (string|null); + + /** SessionEntityType entityOverrideMode */ + entityOverrideMode?: (google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode|keyof typeof google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode|null); + + /** SessionEntityType entities */ + entities?: (google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity[]|null); + } + + /** Represents a SessionEntityType. */ + class SessionEntityType implements ISessionEntityType { + + /** + * Constructs a new SessionEntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ISessionEntityType); + + /** SessionEntityType name. */ + public name: string; + + /** SessionEntityType entityOverrideMode. */ + public entityOverrideMode: (google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode|keyof typeof google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode); + + /** SessionEntityType entities. */ + public entities: google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity[]; + + /** + * Creates a new SessionEntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns SessionEntityType instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ISessionEntityType): google.cloud.dialogflow.cx.v3beta1.SessionEntityType; + + /** + * Encodes the specified SessionEntityType message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify|verify} messages. + * @param message SessionEntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SessionEntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify|verify} messages. + * @param message SessionEntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SessionEntityType + * @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.SessionEntityType; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SessionEntityType + * @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.SessionEntityType; + + /** + * Verifies a SessionEntityType 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 a SessionEntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SessionEntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.SessionEntityType; + + /** + * Creates a plain object from a SessionEntityType message. Also converts values to other types if specified. + * @param message SessionEntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.SessionEntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SessionEntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SessionEntityType { + + /** EntityOverrideMode enum. */ + enum EntityOverrideMode { + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0, + ENTITY_OVERRIDE_MODE_OVERRIDE = 1, + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 + } + } + + /** Properties of a ListSessionEntityTypesRequest. */ + interface IListSessionEntityTypesRequest { + + /** ListSessionEntityTypesRequest parent */ + parent?: (string|null); + + /** ListSessionEntityTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListSessionEntityTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListSessionEntityTypesRequest. */ + class ListSessionEntityTypesRequest implements IListSessionEntityTypesRequest { + + /** + * Constructs a new ListSessionEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest); + + /** ListSessionEntityTypesRequest parent. */ + public parent: string; + + /** ListSessionEntityTypesRequest pageSize. */ + public pageSize: number; + + /** ListSessionEntityTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListSessionEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSessionEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest): google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest; + + /** + * Encodes the specified ListSessionEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @param message ListSessionEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSessionEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @param message ListSessionEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSessionEntityTypesRequest + * @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.ListSessionEntityTypesRequest; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSessionEntityTypesRequest + * @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.ListSessionEntityTypesRequest; + + /** + * Verifies a ListSessionEntityTypesRequest 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 a ListSessionEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSessionEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest; + + /** + * Creates a plain object from a ListSessionEntityTypesRequest message. Also converts values to other types if specified. + * @param message ListSessionEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSessionEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListSessionEntityTypesResponse. */ + interface IListSessionEntityTypesResponse { + + /** ListSessionEntityTypesResponse sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[]|null); + + /** ListSessionEntityTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSessionEntityTypesResponse. */ + class ListSessionEntityTypesResponse implements IListSessionEntityTypesResponse { + + /** + * Constructs a new ListSessionEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse); + + /** ListSessionEntityTypesResponse sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[]; + + /** ListSessionEntityTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSessionEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSessionEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse): google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse; + + /** + * Encodes the specified ListSessionEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @param message ListSessionEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSessionEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @param message ListSessionEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSessionEntityTypesResponse + * @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.ListSessionEntityTypesResponse; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSessionEntityTypesResponse + * @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.ListSessionEntityTypesResponse; + + /** + * Verifies a ListSessionEntityTypesResponse 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 a ListSessionEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSessionEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse; + + /** + * Creates a plain object from a ListSessionEntityTypesResponse message. Also converts values to other types if specified. + * @param message ListSessionEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSessionEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetSessionEntityTypeRequest. */ + interface IGetSessionEntityTypeRequest { + + /** GetSessionEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a GetSessionEntityTypeRequest. */ + class GetSessionEntityTypeRequest implements IGetSessionEntityTypeRequest { + + /** + * Constructs a new GetSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest); + + /** GetSessionEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new GetSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest; + + /** + * Encodes the specified GetSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @param message GetSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @param message GetSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSessionEntityTypeRequest + * @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.GetSessionEntityTypeRequest; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSessionEntityTypeRequest + * @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.GetSessionEntityTypeRequest; + + /** + * Verifies a GetSessionEntityTypeRequest 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 a GetSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest; + + /** + * Creates a plain object from a GetSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message GetSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateSessionEntityTypeRequest. */ + interface ICreateSessionEntityTypeRequest { + + /** CreateSessionEntityTypeRequest parent */ + parent?: (string|null); + + /** CreateSessionEntityTypeRequest sessionEntityType */ + sessionEntityType?: (google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null); + } + + /** Represents a CreateSessionEntityTypeRequest. */ + class CreateSessionEntityTypeRequest implements ICreateSessionEntityTypeRequest { + + /** + * Constructs a new CreateSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest); + + /** CreateSessionEntityTypeRequest parent. */ + public parent: string; + + /** CreateSessionEntityTypeRequest sessionEntityType. */ + public sessionEntityType?: (google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null); + + /** + * Creates a new CreateSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @param message CreateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @param message CreateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSessionEntityTypeRequest + * @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.CreateSessionEntityTypeRequest; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSessionEntityTypeRequest + * @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.CreateSessionEntityTypeRequest; + + /** + * Verifies a CreateSessionEntityTypeRequest 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 a CreateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest; + + /** + * Creates a plain object from a CreateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message CreateSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateSessionEntityTypeRequest. */ + interface IUpdateSessionEntityTypeRequest { + + /** UpdateSessionEntityTypeRequest sessionEntityType */ + sessionEntityType?: (google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null); + + /** UpdateSessionEntityTypeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateSessionEntityTypeRequest. */ + class UpdateSessionEntityTypeRequest implements IUpdateSessionEntityTypeRequest { + + /** + * Constructs a new UpdateSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest); + + /** UpdateSessionEntityTypeRequest sessionEntityType. */ + public sessionEntityType?: (google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null); + + /** UpdateSessionEntityTypeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @param message UpdateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @param message UpdateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSessionEntityTypeRequest + * @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.UpdateSessionEntityTypeRequest; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSessionEntityTypeRequest + * @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.UpdateSessionEntityTypeRequest; + + /** + * Verifies an UpdateSessionEntityTypeRequest 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 UpdateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest; + + /** + * Creates a plain object from an UpdateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message UpdateSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteSessionEntityTypeRequest. */ + interface IDeleteSessionEntityTypeRequest { + + /** DeleteSessionEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a DeleteSessionEntityTypeRequest. */ + class DeleteSessionEntityTypeRequest implements IDeleteSessionEntityTypeRequest { + + /** + * Constructs a new DeleteSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest); + + /** DeleteSessionEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new DeleteSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest): google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @param message DeleteSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @param message DeleteSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSessionEntityTypeRequest + * @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.DeleteSessionEntityTypeRequest; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSessionEntityTypeRequest + * @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.DeleteSessionEntityTypeRequest; + + /** + * Verifies a DeleteSessionEntityTypeRequest 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 a DeleteSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest; + + /** + * Creates a plain object from a DeleteSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message DeleteSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a TransitionRouteGroups */ + class TransitionRouteGroups extends $protobuf.rpc.Service { + + /** + * Constructs a new TransitionRouteGroups service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new TransitionRouteGroups service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): TransitionRouteGroups; + + /** + * Calls ListTransitionRouteGroups. + * @param request ListTransitionRouteGroupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListTransitionRouteGroupsResponse + */ + public listTransitionRouteGroups(request: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, callback: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.ListTransitionRouteGroupsCallback): void; + + /** + * Calls ListTransitionRouteGroups. + * @param request ListTransitionRouteGroupsRequest message or plain object + * @returns Promise + */ + public listTransitionRouteGroups(request: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest): Promise; + + /** + * Calls GetTransitionRouteGroup. + * @param request GetTransitionRouteGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TransitionRouteGroup + */ + public getTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, callback: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.GetTransitionRouteGroupCallback): void; + + /** + * Calls GetTransitionRouteGroup. + * @param request GetTransitionRouteGroupRequest message or plain object + * @returns Promise + */ + public getTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest): Promise; + + /** + * Calls CreateTransitionRouteGroup. + * @param request CreateTransitionRouteGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TransitionRouteGroup + */ + public createTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, callback: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.CreateTransitionRouteGroupCallback): void; + + /** + * Calls CreateTransitionRouteGroup. + * @param request CreateTransitionRouteGroupRequest message or plain object + * @returns Promise + */ + public createTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest): Promise; + + /** + * Calls UpdateTransitionRouteGroup. + * @param request UpdateTransitionRouteGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TransitionRouteGroup + */ + public updateTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, callback: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.UpdateTransitionRouteGroupCallback): void; + + /** + * Calls UpdateTransitionRouteGroup. + * @param request UpdateTransitionRouteGroupRequest message or plain object + * @returns Promise + */ + public updateTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest): Promise; + + /** + * Calls DeleteTransitionRouteGroup. + * @param request DeleteTransitionRouteGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, callback: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.DeleteTransitionRouteGroupCallback): void; + + /** + * Calls DeleteTransitionRouteGroup. + * @param request DeleteTransitionRouteGroupRequest message or plain object + * @returns Promise + */ + public deleteTransitionRouteGroup(request: google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest): Promise; + } + + namespace TransitionRouteGroups { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#listTransitionRouteGroups}. + * @param error Error, if any + * @param [response] ListTransitionRouteGroupsResponse + */ + type ListTransitionRouteGroupsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#getTransitionRouteGroup}. + * @param error Error, if any + * @param [response] TransitionRouteGroup + */ + type GetTransitionRouteGroupCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#createTransitionRouteGroup}. + * @param error Error, if any + * @param [response] TransitionRouteGroup + */ + type CreateTransitionRouteGroupCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#updateTransitionRouteGroup}. + * @param error Error, if any + * @param [response] TransitionRouteGroup + */ + type UpdateTransitionRouteGroupCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#deleteTransitionRouteGroup}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteTransitionRouteGroupCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a TransitionRouteGroup. */ + interface ITransitionRouteGroup { + + /** TransitionRouteGroup name */ + name?: (string|null); + + /** TransitionRouteGroup displayName */ + displayName?: (string|null); + + /** TransitionRouteGroup transitionRoutes */ + transitionRoutes?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRoute[]|null); + } + + /** Represents a TransitionRouteGroup. */ + class TransitionRouteGroup implements ITransitionRouteGroup { + + /** + * Constructs a new TransitionRouteGroup. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup); + + /** TransitionRouteGroup name. */ + public name: string; + + /** TransitionRouteGroup displayName. */ + public displayName: string; + + /** TransitionRouteGroup transitionRoutes. */ + public transitionRoutes: google.cloud.dialogflow.cx.v3beta1.ITransitionRoute[]; + + /** + * Creates a new TransitionRouteGroup instance using the specified properties. + * @param [properties] Properties to set + * @returns TransitionRouteGroup instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup): google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup; + + /** + * Encodes the specified TransitionRouteGroup message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify|verify} messages. + * @param message TransitionRouteGroup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TransitionRouteGroup message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify|verify} messages. + * @param message TransitionRouteGroup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TransitionRouteGroup message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TransitionRouteGroup + * @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.TransitionRouteGroup; + + /** + * Decodes a TransitionRouteGroup message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TransitionRouteGroup + * @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.TransitionRouteGroup; + + /** + * Verifies a TransitionRouteGroup 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 a TransitionRouteGroup message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TransitionRouteGroup + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup; + + /** + * Creates a plain object from a TransitionRouteGroup message. Also converts values to other types if specified. + * @param message TransitionRouteGroup + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TransitionRouteGroup to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListTransitionRouteGroupsRequest. */ + interface IListTransitionRouteGroupsRequest { + + /** ListTransitionRouteGroupsRequest parent */ + parent?: (string|null); + + /** ListTransitionRouteGroupsRequest pageSize */ + pageSize?: (number|null); + + /** ListTransitionRouteGroupsRequest pageToken */ + pageToken?: (string|null); + + /** ListTransitionRouteGroupsRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a ListTransitionRouteGroupsRequest. */ + class ListTransitionRouteGroupsRequest implements IListTransitionRouteGroupsRequest { + + /** + * Constructs a new ListTransitionRouteGroupsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest); + + /** ListTransitionRouteGroupsRequest parent. */ + public parent: string; + + /** ListTransitionRouteGroupsRequest pageSize. */ + public pageSize: number; + + /** ListTransitionRouteGroupsRequest pageToken. */ + public pageToken: string; + + /** ListTransitionRouteGroupsRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new ListTransitionRouteGroupsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTransitionRouteGroupsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest): google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest; + + /** + * Encodes the specified ListTransitionRouteGroupsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest.verify|verify} messages. + * @param message ListTransitionRouteGroupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTransitionRouteGroupsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest.verify|verify} messages. + * @param message ListTransitionRouteGroupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTransitionRouteGroupsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTransitionRouteGroupsRequest + * @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.ListTransitionRouteGroupsRequest; + + /** + * Decodes a ListTransitionRouteGroupsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTransitionRouteGroupsRequest + * @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.ListTransitionRouteGroupsRequest; + + /** + * Verifies a ListTransitionRouteGroupsRequest 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 a ListTransitionRouteGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTransitionRouteGroupsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest; + + /** + * Creates a plain object from a ListTransitionRouteGroupsRequest message. Also converts values to other types if specified. + * @param message ListTransitionRouteGroupsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTransitionRouteGroupsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListTransitionRouteGroupsResponse. */ + interface IListTransitionRouteGroupsResponse { + + /** ListTransitionRouteGroupsResponse transitionRouteGroups */ + transitionRouteGroups?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[]|null); + + /** ListTransitionRouteGroupsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListTransitionRouteGroupsResponse. */ + class ListTransitionRouteGroupsResponse implements IListTransitionRouteGroupsResponse { + + /** + * Constructs a new ListTransitionRouteGroupsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse); + + /** ListTransitionRouteGroupsResponse transitionRouteGroups. */ + public transitionRouteGroups: google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[]; + + /** ListTransitionRouteGroupsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListTransitionRouteGroupsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTransitionRouteGroupsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse): google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse; + + /** + * Encodes the specified ListTransitionRouteGroupsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse.verify|verify} messages. + * @param message ListTransitionRouteGroupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTransitionRouteGroupsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse.verify|verify} messages. + * @param message ListTransitionRouteGroupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTransitionRouteGroupsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTransitionRouteGroupsResponse + * @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.ListTransitionRouteGroupsResponse; + + /** + * Decodes a ListTransitionRouteGroupsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTransitionRouteGroupsResponse + * @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.ListTransitionRouteGroupsResponse; + + /** + * Verifies a ListTransitionRouteGroupsResponse 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 a ListTransitionRouteGroupsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTransitionRouteGroupsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse; + + /** + * Creates a plain object from a ListTransitionRouteGroupsResponse message. Also converts values to other types if specified. + * @param message ListTransitionRouteGroupsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTransitionRouteGroupsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetTransitionRouteGroupRequest. */ + interface IGetTransitionRouteGroupRequest { + + /** GetTransitionRouteGroupRequest name */ + name?: (string|null); + + /** GetTransitionRouteGroupRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetTransitionRouteGroupRequest. */ + class GetTransitionRouteGroupRequest implements IGetTransitionRouteGroupRequest { + + /** + * Constructs a new GetTransitionRouteGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest); + + /** GetTransitionRouteGroupRequest name. */ + public name: string; + + /** GetTransitionRouteGroupRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetTransitionRouteGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetTransitionRouteGroupRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest): google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest; + + /** + * Encodes the specified GetTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest.verify|verify} messages. + * @param message GetTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest.verify|verify} messages. + * @param message GetTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetTransitionRouteGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetTransitionRouteGroupRequest + * @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.GetTransitionRouteGroupRequest; + + /** + * Decodes a GetTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetTransitionRouteGroupRequest + * @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.GetTransitionRouteGroupRequest; + + /** + * Verifies a GetTransitionRouteGroupRequest 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 a GetTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetTransitionRouteGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest; + + /** + * Creates a plain object from a GetTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @param message GetTransitionRouteGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetTransitionRouteGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateTransitionRouteGroupRequest. */ + interface ICreateTransitionRouteGroupRequest { + + /** CreateTransitionRouteGroupRequest parent */ + parent?: (string|null); + + /** CreateTransitionRouteGroupRequest transitionRouteGroup */ + transitionRouteGroup?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null); + + /** CreateTransitionRouteGroupRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreateTransitionRouteGroupRequest. */ + class CreateTransitionRouteGroupRequest implements ICreateTransitionRouteGroupRequest { + + /** + * Constructs a new CreateTransitionRouteGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest); + + /** CreateTransitionRouteGroupRequest parent. */ + public parent: string; + + /** CreateTransitionRouteGroupRequest transitionRouteGroup. */ + public transitionRouteGroup?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null); + + /** CreateTransitionRouteGroupRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreateTransitionRouteGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTransitionRouteGroupRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest): google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest; + + /** + * Encodes the specified CreateTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest.verify|verify} messages. + * @param message CreateTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest.verify|verify} messages. + * @param message CreateTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTransitionRouteGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTransitionRouteGroupRequest + * @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.CreateTransitionRouteGroupRequest; + + /** + * Decodes a CreateTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTransitionRouteGroupRequest + * @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.CreateTransitionRouteGroupRequest; + + /** + * Verifies a CreateTransitionRouteGroupRequest 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 a CreateTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTransitionRouteGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest; + + /** + * Creates a plain object from a CreateTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @param message CreateTransitionRouteGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTransitionRouteGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateTransitionRouteGroupRequest. */ + interface IUpdateTransitionRouteGroupRequest { + + /** UpdateTransitionRouteGroupRequest transitionRouteGroup */ + transitionRouteGroup?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null); + + /** UpdateTransitionRouteGroupRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateTransitionRouteGroupRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents an UpdateTransitionRouteGroupRequest. */ + class UpdateTransitionRouteGroupRequest implements IUpdateTransitionRouteGroupRequest { + + /** + * Constructs a new UpdateTransitionRouteGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest); + + /** UpdateTransitionRouteGroupRequest transitionRouteGroup. */ + public transitionRouteGroup?: (google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null); + + /** UpdateTransitionRouteGroupRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateTransitionRouteGroupRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new UpdateTransitionRouteGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateTransitionRouteGroupRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest): google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest; + + /** + * Encodes the specified UpdateTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest.verify|verify} messages. + * @param message UpdateTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest.verify|verify} messages. + * @param message UpdateTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateTransitionRouteGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateTransitionRouteGroupRequest + * @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.UpdateTransitionRouteGroupRequest; + + /** + * Decodes an UpdateTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateTransitionRouteGroupRequest + * @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.UpdateTransitionRouteGroupRequest; + + /** + * Verifies an UpdateTransitionRouteGroupRequest 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 UpdateTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateTransitionRouteGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest; + + /** + * Creates a plain object from an UpdateTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @param message UpdateTransitionRouteGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateTransitionRouteGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteTransitionRouteGroupRequest. */ + interface IDeleteTransitionRouteGroupRequest { + + /** DeleteTransitionRouteGroupRequest name */ + name?: (string|null); + + /** DeleteTransitionRouteGroupRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteTransitionRouteGroupRequest. */ + class DeleteTransitionRouteGroupRequest implements IDeleteTransitionRouteGroupRequest { + + /** + * Constructs a new DeleteTransitionRouteGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest); + + /** DeleteTransitionRouteGroupRequest name. */ + public name: string; + + /** DeleteTransitionRouteGroupRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteTransitionRouteGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteTransitionRouteGroupRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest): google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest; + + /** + * Encodes the specified DeleteTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest.verify|verify} messages. + * @param message DeleteTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest.verify|verify} messages. + * @param message DeleteTransitionRouteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteTransitionRouteGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteTransitionRouteGroupRequest + * @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.DeleteTransitionRouteGroupRequest; + + /** + * Decodes a DeleteTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteTransitionRouteGroupRequest + * @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.DeleteTransitionRouteGroupRequest; + + /** + * Verifies a DeleteTransitionRouteGroupRequest 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 a DeleteTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteTransitionRouteGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest; + + /** + * Creates a plain object from a DeleteTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @param message DeleteTransitionRouteGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteTransitionRouteGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a Versions */ + class Versions extends $protobuf.rpc.Service { + + /** + * Constructs a new Versions service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Versions service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Versions; + + /** + * Calls ListVersions. + * @param request ListVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListVersionsResponse + */ + public listVersions(request: google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, callback: google.cloud.dialogflow.cx.v3beta1.Versions.ListVersionsCallback): void; + + /** + * Calls ListVersions. + * @param request ListVersionsRequest message or plain object + * @returns Promise + */ + public listVersions(request: google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest): Promise; + + /** + * Calls GetVersion. + * @param request GetVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public getVersion(request: google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, callback: google.cloud.dialogflow.cx.v3beta1.Versions.GetVersionCallback): void; + + /** + * Calls GetVersion. + * @param request GetVersionRequest message or plain object + * @returns Promise + */ + public getVersion(request: google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest): Promise; + + /** + * Calls CreateVersion. + * @param request CreateVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createVersion(request: google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, callback: google.cloud.dialogflow.cx.v3beta1.Versions.CreateVersionCallback): void; + + /** + * Calls CreateVersion. + * @param request CreateVersionRequest message or plain object + * @returns Promise + */ + public createVersion(request: google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest): Promise; + + /** + * Calls UpdateVersion. + * @param request UpdateVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public updateVersion(request: google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, callback: google.cloud.dialogflow.cx.v3beta1.Versions.UpdateVersionCallback): void; + + /** + * Calls UpdateVersion. + * @param request UpdateVersionRequest message or plain object + * @returns Promise + */ + public updateVersion(request: google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest): Promise; + + /** + * Calls DeleteVersion. + * @param request DeleteVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteVersion(request: google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, callback: google.cloud.dialogflow.cx.v3beta1.Versions.DeleteVersionCallback): void; + + /** + * Calls DeleteVersion. + * @param request DeleteVersionRequest message or plain object + * @returns Promise + */ + public deleteVersion(request: google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest): Promise; + + /** + * Calls LoadVersion. + * @param request LoadVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public loadVersion(request: google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, callback: google.cloud.dialogflow.cx.v3beta1.Versions.LoadVersionCallback): void; + + /** + * Calls LoadVersion. + * @param request LoadVersionRequest message or plain object + * @returns Promise + */ + public loadVersion(request: google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest): Promise; + } + + namespace Versions { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#listVersions}. + * @param error Error, if any + * @param [response] ListVersionsResponse + */ + type ListVersionsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#getVersion}. + * @param error Error, if any + * @param [response] Version + */ + type GetVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#createVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#updateVersion}. + * @param error Error, if any + * @param [response] Version + */ + type UpdateVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#deleteVersion}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteVersionCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#loadVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type LoadVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a CreateVersionOperationMetadata. */ + interface ICreateVersionOperationMetadata { + + /** CreateVersionOperationMetadata version */ + version?: (string|null); + } + + /** Represents a CreateVersionOperationMetadata. */ + class CreateVersionOperationMetadata implements ICreateVersionOperationMetadata { + + /** + * Constructs a new CreateVersionOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata); + + /** CreateVersionOperationMetadata version. */ + public version: string; + + /** + * Creates a new CreateVersionOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateVersionOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata): google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata; + + /** + * Encodes the specified CreateVersionOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata.verify|verify} messages. + * @param message CreateVersionOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateVersionOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata.verify|verify} messages. + * @param message CreateVersionOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateVersionOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateVersionOperationMetadata + * @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.CreateVersionOperationMetadata; + + /** + * Decodes a CreateVersionOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateVersionOperationMetadata + * @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.CreateVersionOperationMetadata; + + /** + * Verifies a CreateVersionOperationMetadata 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 a CreateVersionOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateVersionOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata; + + /** + * Creates a plain object from a CreateVersionOperationMetadata message. Also converts values to other types if specified. + * @param message CreateVersionOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateVersionOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Version. */ + interface IVersion { + + /** Version name */ + name?: (string|null); + + /** Version displayName */ + displayName?: (string|null); + + /** Version description */ + description?: (string|null); + + /** Version nluSettings */ + nluSettings?: (google.cloud.dialogflow.cx.v3beta1.INluSettings|null); + + /** Version createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Version state */ + state?: (google.cloud.dialogflow.cx.v3beta1.Version.State|keyof typeof google.cloud.dialogflow.cx.v3beta1.Version.State|null); + } + + /** Represents a Version. */ + class Version implements IVersion { + + /** + * Constructs a new Version. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IVersion); + + /** Version name. */ + public name: string; + + /** Version displayName. */ + public displayName: string; + + /** Version description. */ + public description: string; + + /** Version nluSettings. */ + public nluSettings?: (google.cloud.dialogflow.cx.v3beta1.INluSettings|null); + + /** Version createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Version state. */ + public state: (google.cloud.dialogflow.cx.v3beta1.Version.State|keyof typeof google.cloud.dialogflow.cx.v3beta1.Version.State); + + /** + * Creates a new Version instance using the specified properties. + * @param [properties] Properties to set + * @returns Version instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IVersion): google.cloud.dialogflow.cx.v3beta1.Version; + + /** + * Encodes the specified Version message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Version.verify|verify} messages. + * @param message Version message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Version.verify|verify} messages. + * @param message Version message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Version message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Version + * @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.Version; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Version + * @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.Version; + + /** + * Verifies a Version 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 a Version message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Version + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Version; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @param message Version + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Version, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Version to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Version { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + SUCCEEDED = 2, + FAILED = 3 + } + } + + /** Properties of a ListVersionsRequest. */ + interface IListVersionsRequest { + + /** ListVersionsRequest parent */ + parent?: (string|null); + + /** ListVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListVersionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListVersionsRequest. */ + class ListVersionsRequest implements IListVersionsRequest { + + /** + * Constructs a new ListVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest); + + /** ListVersionsRequest parent. */ + public parent: string; + + /** ListVersionsRequest pageSize. */ + public pageSize: number; + + /** ListVersionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVersionsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest): google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest; + + /** + * Encodes the specified ListVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest.verify|verify} messages. + * @param message ListVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest.verify|verify} messages. + * @param message ListVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVersionsRequest + * @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.ListVersionsRequest; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVersionsRequest + * @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.ListVersionsRequest; + + /** + * Verifies a ListVersionsRequest 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 a ListVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest; + + /** + * Creates a plain object from a ListVersionsRequest message. Also converts values to other types if specified. + * @param message ListVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListVersionsResponse. */ + interface IListVersionsResponse { + + /** ListVersionsResponse versions */ + versions?: (google.cloud.dialogflow.cx.v3beta1.IVersion[]|null); + + /** ListVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListVersionsResponse. */ + class ListVersionsResponse implements IListVersionsResponse { + + /** + * Constructs a new ListVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse); + + /** ListVersionsResponse versions. */ + public versions: google.cloud.dialogflow.cx.v3beta1.IVersion[]; + + /** ListVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVersionsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse): google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse; + + /** + * Encodes the specified ListVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse.verify|verify} messages. + * @param message ListVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse.verify|verify} messages. + * @param message ListVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVersionsResponse + * @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.ListVersionsResponse; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVersionsResponse + * @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.ListVersionsResponse; + + /** + * Verifies a ListVersionsResponse 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 a ListVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse; + + /** + * Creates a plain object from a ListVersionsResponse message. Also converts values to other types if specified. + * @param message ListVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetVersionRequest. */ + interface IGetVersionRequest { + + /** GetVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetVersionRequest. */ + class GetVersionRequest implements IGetVersionRequest { + + /** + * Constructs a new GetVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest); + + /** GetVersionRequest name. */ + public name: string; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest): google.cloud.dialogflow.cx.v3beta1.GetVersionRequest; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetVersionRequest + * @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.GetVersionRequest; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetVersionRequest + * @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.GetVersionRequest; + + /** + * Verifies a GetVersionRequest 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 a GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetVersionRequest; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @param message GetVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateVersionRequest. */ + interface ICreateVersionRequest { + + /** CreateVersionRequest parent */ + parent?: (string|null); + + /** CreateVersionRequest version */ + version?: (google.cloud.dialogflow.cx.v3beta1.IVersion|null); + } + + /** Represents a CreateVersionRequest. */ + class CreateVersionRequest implements ICreateVersionRequest { + + /** + * Constructs a new CreateVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest); + + /** CreateVersionRequest parent. */ + public parent: string; + + /** CreateVersionRequest version. */ + public version?: (google.cloud.dialogflow.cx.v3beta1.IVersion|null); + + /** + * Creates a new CreateVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest): google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest; + + /** + * Encodes the specified CreateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest.verify|verify} messages. + * @param message CreateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest.verify|verify} messages. + * @param message CreateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateVersionRequest + * @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.CreateVersionRequest; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateVersionRequest + * @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.CreateVersionRequest; + + /** + * Verifies a CreateVersionRequest 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 a CreateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest; + + /** + * Creates a plain object from a CreateVersionRequest message. Also converts values to other types if specified. + * @param message CreateVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateVersionRequest. */ + interface IUpdateVersionRequest { + + /** UpdateVersionRequest version */ + version?: (google.cloud.dialogflow.cx.v3beta1.IVersion|null); + + /** UpdateVersionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateVersionRequest. */ + class UpdateVersionRequest implements IUpdateVersionRequest { + + /** + * Constructs a new UpdateVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest); + + /** UpdateVersionRequest version. */ + public version?: (google.cloud.dialogflow.cx.v3beta1.IVersion|null); + + /** UpdateVersionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest): google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest; + + /** + * Encodes the specified UpdateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest.verify|verify} messages. + * @param message UpdateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest.verify|verify} messages. + * @param message UpdateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateVersionRequest + * @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.UpdateVersionRequest; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateVersionRequest + * @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.UpdateVersionRequest; + + /** + * Verifies an UpdateVersionRequest 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 UpdateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest; + + /** + * Creates a plain object from an UpdateVersionRequest message. Also converts values to other types if specified. + * @param message UpdateVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteVersionRequest. */ + interface IDeleteVersionRequest { + + /** DeleteVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteVersionRequest. */ + class DeleteVersionRequest implements IDeleteVersionRequest { + + /** + * Constructs a new DeleteVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest); + + /** DeleteVersionRequest name. */ + public name: string; + + /** + * Creates a new DeleteVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest): google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest; + + /** + * Encodes the specified DeleteVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest.verify|verify} messages. + * @param message DeleteVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest.verify|verify} messages. + * @param message DeleteVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteVersionRequest + * @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.DeleteVersionRequest; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteVersionRequest + * @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.DeleteVersionRequest; + + /** + * Verifies a DeleteVersionRequest 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 a DeleteVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest; + + /** + * Creates a plain object from a DeleteVersionRequest message. Also converts values to other types if specified. + * @param message DeleteVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LoadVersionRequest. */ + interface ILoadVersionRequest { + + /** LoadVersionRequest name */ + name?: (string|null); + + /** LoadVersionRequest allowOverrideAgentResources */ + allowOverrideAgentResources?: (boolean|null); + } + + /** Represents a LoadVersionRequest. */ + class LoadVersionRequest implements ILoadVersionRequest { + + /** + * Constructs a new LoadVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest); + + /** LoadVersionRequest name. */ + public name: string; + + /** LoadVersionRequest allowOverrideAgentResources. */ + public allowOverrideAgentResources: boolean; + + /** + * Creates a new LoadVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns LoadVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest): google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest; + + /** + * Encodes the specified LoadVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest.verify|verify} messages. + * @param message LoadVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LoadVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest.verify|verify} messages. + * @param message LoadVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LoadVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LoadVersionRequest + * @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.LoadVersionRequest; + + /** + * Decodes a LoadVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LoadVersionRequest + * @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.LoadVersionRequest; + + /** + * Verifies a LoadVersionRequest 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 a LoadVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LoadVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest; + + /** + * Creates a plain object from a LoadVersionRequest message. Also converts values to other types if specified. + * @param message LoadVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LoadVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a Webhooks */ + class Webhooks extends $protobuf.rpc.Service { + + /** + * Constructs a new Webhooks service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Webhooks service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Webhooks; + + /** + * Calls ListWebhooks. + * @param request ListWebhooksRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListWebhooksResponse + */ + public listWebhooks(request: google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, callback: google.cloud.dialogflow.cx.v3beta1.Webhooks.ListWebhooksCallback): void; + + /** + * Calls ListWebhooks. + * @param request ListWebhooksRequest message or plain object + * @returns Promise + */ + public listWebhooks(request: google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest): Promise; + + /** + * Calls GetWebhook. + * @param request GetWebhookRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Webhook + */ + public getWebhook(request: google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, callback: google.cloud.dialogflow.cx.v3beta1.Webhooks.GetWebhookCallback): void; + + /** + * Calls GetWebhook. + * @param request GetWebhookRequest message or plain object + * @returns Promise + */ + public getWebhook(request: google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest): Promise; + + /** + * Calls CreateWebhook. + * @param request CreateWebhookRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Webhook + */ + public createWebhook(request: google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, callback: google.cloud.dialogflow.cx.v3beta1.Webhooks.CreateWebhookCallback): void; + + /** + * Calls CreateWebhook. + * @param request CreateWebhookRequest message or plain object + * @returns Promise + */ + public createWebhook(request: google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest): Promise; + + /** + * Calls UpdateWebhook. + * @param request UpdateWebhookRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Webhook + */ + public updateWebhook(request: google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, callback: google.cloud.dialogflow.cx.v3beta1.Webhooks.UpdateWebhookCallback): void; + + /** + * Calls UpdateWebhook. + * @param request UpdateWebhookRequest message or plain object + * @returns Promise + */ + public updateWebhook(request: google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest): Promise; + + /** + * Calls DeleteWebhook. + * @param request DeleteWebhookRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteWebhook(request: google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, callback: google.cloud.dialogflow.cx.v3beta1.Webhooks.DeleteWebhookCallback): void; + + /** + * Calls DeleteWebhook. + * @param request DeleteWebhookRequest message or plain object + * @returns Promise + */ + public deleteWebhook(request: google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest): Promise; + } + + namespace Webhooks { + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#listWebhooks}. + * @param error Error, if any + * @param [response] ListWebhooksResponse + */ + type ListWebhooksCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#getWebhook}. + * @param error Error, if any + * @param [response] Webhook + */ + type GetWebhookCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Webhook) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#createWebhook}. + * @param error Error, if any + * @param [response] Webhook + */ + type CreateWebhookCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Webhook) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#updateWebhook}. + * @param error Error, if any + * @param [response] Webhook + */ + type UpdateWebhookCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3beta1.Webhook) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#deleteWebhook}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteWebhookCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a Webhook. */ + interface IWebhook { + + /** Webhook name */ + name?: (string|null); + + /** Webhook displayName */ + displayName?: (string|null); + + /** Webhook genericWebService */ + genericWebService?: (google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService|null); + + /** Webhook timeout */ + timeout?: (google.protobuf.IDuration|null); + + /** Webhook disabled */ + disabled?: (boolean|null); + } + + /** Represents a Webhook. */ + class Webhook implements IWebhook { + + /** + * Constructs a new Webhook. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IWebhook); + + /** Webhook name. */ + public name: string; + + /** Webhook displayName. */ + public displayName: string; + + /** Webhook genericWebService. */ + public genericWebService?: (google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService|null); + + /** Webhook timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** Webhook disabled. */ + public disabled: boolean; + + /** Webhook webhook. */ + public webhook?: "genericWebService"; + + /** + * Creates a new Webhook instance using the specified properties. + * @param [properties] Properties to set + * @returns Webhook instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IWebhook): google.cloud.dialogflow.cx.v3beta1.Webhook; + + /** + * Encodes the specified Webhook message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.verify|verify} messages. + * @param message Webhook message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IWebhook, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Webhook message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.verify|verify} messages. + * @param message Webhook message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IWebhook, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Webhook message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Webhook + * @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.Webhook; + + /** + * Decodes a Webhook message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Webhook + * @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.Webhook; + + /** + * Verifies a Webhook 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 a Webhook message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Webhook + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Webhook; + + /** + * Creates a plain object from a Webhook message. Also converts values to other types if specified. + * @param message Webhook + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Webhook, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Webhook to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Webhook { + + /** Properties of a GenericWebService. */ + interface IGenericWebService { + + /** GenericWebService uri */ + uri?: (string|null); + + /** GenericWebService username */ + username?: (string|null); + + /** GenericWebService password */ + password?: (string|null); + + /** GenericWebService requestHeaders */ + requestHeaders?: ({ [k: string]: string }|null); + } + + /** Represents a GenericWebService. */ + class GenericWebService implements IGenericWebService { + + /** + * Constructs a new GenericWebService. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService); + + /** GenericWebService uri. */ + public uri: string; + + /** GenericWebService username. */ + public username: string; + + /** GenericWebService password. */ + public password: string; + + /** GenericWebService requestHeaders. */ + public requestHeaders: { [k: string]: string }; + + /** + * Creates a new GenericWebService instance using the specified properties. + * @param [properties] Properties to set + * @returns GenericWebService instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService): google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService; + + /** + * Encodes the specified GenericWebService message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.verify|verify} messages. + * @param message GenericWebService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenericWebService message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.verify|verify} messages. + * @param message GenericWebService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenericWebService message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenericWebService + * @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.Webhook.GenericWebService; + + /** + * Decodes a GenericWebService message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenericWebService + * @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.Webhook.GenericWebService; + + /** + * Verifies a GenericWebService 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 a GenericWebService message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenericWebService + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService; + + /** + * Creates a plain object from a GenericWebService message. Also converts values to other types if specified. + * @param message GenericWebService + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenericWebService to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ListWebhooksRequest. */ + interface IListWebhooksRequest { + + /** ListWebhooksRequest parent */ + parent?: (string|null); + + /** ListWebhooksRequest pageSize */ + pageSize?: (number|null); + + /** ListWebhooksRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListWebhooksRequest. */ + class ListWebhooksRequest implements IListWebhooksRequest { + + /** + * Constructs a new ListWebhooksRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest); + + /** ListWebhooksRequest parent. */ + public parent: string; + + /** ListWebhooksRequest pageSize. */ + public pageSize: number; + + /** ListWebhooksRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListWebhooksRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWebhooksRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest): google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest; + + /** + * Encodes the specified ListWebhooksRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest.verify|verify} messages. + * @param message ListWebhooksRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWebhooksRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest.verify|verify} messages. + * @param message ListWebhooksRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWebhooksRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWebhooksRequest + * @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.ListWebhooksRequest; + + /** + * Decodes a ListWebhooksRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWebhooksRequest + * @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.ListWebhooksRequest; + + /** + * Verifies a ListWebhooksRequest 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 a ListWebhooksRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWebhooksRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest; + + /** + * Creates a plain object from a ListWebhooksRequest message. Also converts values to other types if specified. + * @param message ListWebhooksRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWebhooksRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListWebhooksResponse. */ + interface IListWebhooksResponse { + + /** ListWebhooksResponse webhooks */ + webhooks?: (google.cloud.dialogflow.cx.v3beta1.IWebhook[]|null); + + /** ListWebhooksResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListWebhooksResponse. */ + class ListWebhooksResponse implements IListWebhooksResponse { + + /** + * Constructs a new ListWebhooksResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse); + + /** ListWebhooksResponse webhooks. */ + public webhooks: google.cloud.dialogflow.cx.v3beta1.IWebhook[]; + + /** ListWebhooksResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListWebhooksResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWebhooksResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse): google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse; + + /** + * Encodes the specified ListWebhooksResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse.verify|verify} messages. + * @param message ListWebhooksResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWebhooksResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse.verify|verify} messages. + * @param message ListWebhooksResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWebhooksResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWebhooksResponse + * @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.ListWebhooksResponse; + + /** + * Decodes a ListWebhooksResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWebhooksResponse + * @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.ListWebhooksResponse; + + /** + * Verifies a ListWebhooksResponse 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 a ListWebhooksResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWebhooksResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse; + + /** + * Creates a plain object from a ListWebhooksResponse message. Also converts values to other types if specified. + * @param message ListWebhooksResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWebhooksResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetWebhookRequest. */ + interface IGetWebhookRequest { + + /** GetWebhookRequest name */ + name?: (string|null); + } + + /** Represents a GetWebhookRequest. */ + class GetWebhookRequest implements IGetWebhookRequest { + + /** + * Constructs a new GetWebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest); + + /** GetWebhookRequest name. */ + public name: string; + + /** + * Creates a new GetWebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetWebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest): google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest; + + /** + * Encodes the specified GetWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest.verify|verify} messages. + * @param message GetWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest.verify|verify} messages. + * @param message GetWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetWebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetWebhookRequest + * @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.GetWebhookRequest; + + /** + * Decodes a GetWebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetWebhookRequest + * @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.GetWebhookRequest; + + /** + * Verifies a GetWebhookRequest 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 a GetWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetWebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest; + + /** + * Creates a plain object from a GetWebhookRequest message. Also converts values to other types if specified. + * @param message GetWebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetWebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateWebhookRequest. */ + interface ICreateWebhookRequest { + + /** CreateWebhookRequest parent */ + parent?: (string|null); + + /** CreateWebhookRequest webhook */ + webhook?: (google.cloud.dialogflow.cx.v3beta1.IWebhook|null); + } + + /** Represents a CreateWebhookRequest. */ + class CreateWebhookRequest implements ICreateWebhookRequest { + + /** + * Constructs a new CreateWebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest); + + /** CreateWebhookRequest parent. */ + public parent: string; + + /** CreateWebhookRequest webhook. */ + public webhook?: (google.cloud.dialogflow.cx.v3beta1.IWebhook|null); + + /** + * Creates a new CreateWebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateWebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest): google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest; + + /** + * Encodes the specified CreateWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest.verify|verify} messages. + * @param message CreateWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest.verify|verify} messages. + * @param message CreateWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateWebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateWebhookRequest + * @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.CreateWebhookRequest; + + /** + * Decodes a CreateWebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateWebhookRequest + * @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.CreateWebhookRequest; + + /** + * Verifies a CreateWebhookRequest 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 a CreateWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateWebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest; + + /** + * Creates a plain object from a CreateWebhookRequest message. Also converts values to other types if specified. + * @param message CreateWebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateWebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateWebhookRequest. */ + interface IUpdateWebhookRequest { + + /** UpdateWebhookRequest webhook */ + webhook?: (google.cloud.dialogflow.cx.v3beta1.IWebhook|null); + + /** UpdateWebhookRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateWebhookRequest. */ + class UpdateWebhookRequest implements IUpdateWebhookRequest { + + /** + * Constructs a new UpdateWebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest); + + /** UpdateWebhookRequest webhook. */ + public webhook?: (google.cloud.dialogflow.cx.v3beta1.IWebhook|null); + + /** UpdateWebhookRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateWebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateWebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest): google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest; + + /** + * Encodes the specified UpdateWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest.verify|verify} messages. + * @param message UpdateWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest.verify|verify} messages. + * @param message UpdateWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateWebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateWebhookRequest + * @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.UpdateWebhookRequest; + + /** + * Decodes an UpdateWebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateWebhookRequest + * @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.UpdateWebhookRequest; + + /** + * Verifies an UpdateWebhookRequest 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 UpdateWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateWebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest; + + /** + * Creates a plain object from an UpdateWebhookRequest message. Also converts values to other types if specified. + * @param message UpdateWebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateWebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteWebhookRequest. */ + interface IDeleteWebhookRequest { + + /** DeleteWebhookRequest name */ + name?: (string|null); + + /** DeleteWebhookRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteWebhookRequest. */ + class DeleteWebhookRequest implements IDeleteWebhookRequest { + + /** + * Constructs a new DeleteWebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest); + + /** DeleteWebhookRequest name. */ + public name: string; + + /** DeleteWebhookRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteWebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteWebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest): google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest; + + /** + * Encodes the specified DeleteWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest.verify|verify} messages. + * @param message DeleteWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest.verify|verify} messages. + * @param message DeleteWebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteWebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteWebhookRequest + * @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.DeleteWebhookRequest; + + /** + * Decodes a DeleteWebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteWebhookRequest + * @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.DeleteWebhookRequest; + + /** + * Verifies a DeleteWebhookRequest 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 a DeleteWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteWebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest; + + /** + * Creates a plain object from a DeleteWebhookRequest message. Also converts values to other types if specified. + * @param message DeleteWebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteWebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a WebhookRequest. */ + interface IWebhookRequest { + + /** WebhookRequest detectIntentResponseId */ + detectIntentResponseId?: (string|null); + + /** WebhookRequest fulfillmentInfo */ + fulfillmentInfo?: (google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo|null); + + /** WebhookRequest intentInfo */ + intentInfo?: (google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo|null); + + /** WebhookRequest pageInfo */ + pageInfo?: (google.cloud.dialogflow.cx.v3beta1.IPageInfo|null); + + /** WebhookRequest sessionInfo */ + sessionInfo?: (google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null); + + /** WebhookRequest messages */ + messages?: (google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]|null); + + /** WebhookRequest payload */ + payload?: (google.protobuf.IStruct|null); + } + + /** Represents a WebhookRequest. */ + class WebhookRequest implements IWebhookRequest { + + /** + * Constructs a new WebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IWebhookRequest); + + /** WebhookRequest detectIntentResponseId. */ + public detectIntentResponseId: string; + + /** WebhookRequest fulfillmentInfo. */ + public fulfillmentInfo?: (google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo|null); + + /** WebhookRequest intentInfo. */ + public intentInfo?: (google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo|null); + + /** WebhookRequest pageInfo. */ + public pageInfo?: (google.cloud.dialogflow.cx.v3beta1.IPageInfo|null); + + /** WebhookRequest sessionInfo. */ + public sessionInfo?: (google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null); + + /** WebhookRequest messages. */ + public messages: google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]; + + /** WebhookRequest payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** + * Creates a new WebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IWebhookRequest): google.cloud.dialogflow.cx.v3beta1.WebhookRequest; + + /** + * Encodes the specified WebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.verify|verify} messages. + * @param message WebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.verify|verify} messages. + * @param message WebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebhookRequest + * @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.WebhookRequest; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebhookRequest + * @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.WebhookRequest; + + /** + * Verifies a WebhookRequest 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 a WebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.WebhookRequest; + + /** + * Creates a plain object from a WebhookRequest message. Also converts values to other types if specified. + * @param message WebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WebhookRequest { + + /** Properties of a FulfillmentInfo. */ + interface IFulfillmentInfo { + + /** FulfillmentInfo tag */ + tag?: (string|null); + } + + /** Represents a FulfillmentInfo. */ + class FulfillmentInfo implements IFulfillmentInfo { + + /** + * Constructs a new FulfillmentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo); + + /** FulfillmentInfo tag. */ + public tag: string; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillmentInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo): google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.verify|verify} messages. + * @param message FulfillmentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillmentInfo + * @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.WebhookRequest.FulfillmentInfo; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillmentInfo + * @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.WebhookRequest.FulfillmentInfo; + + /** + * Verifies a FulfillmentInfo 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 a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillmentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo; + + /** + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @param message FulfillmentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillmentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an IntentInfo. */ + interface IIntentInfo { + + /** IntentInfo lastMatchedIntent */ + lastMatchedIntent?: (string|null); + + /** IntentInfo parameters */ + parameters?: ({ [k: string]: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue }|null); + } + + /** Represents an IntentInfo. */ + class IntentInfo implements IIntentInfo { + + /** + * Constructs a new IntentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo); + + /** IntentInfo lastMatchedIntent. */ + public lastMatchedIntent: string; + + /** IntentInfo parameters. */ + public parameters: { [k: string]: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue }; + + /** + * Creates a new IntentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns IntentInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo): google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo; + + /** + * Encodes the specified IntentInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.verify|verify} messages. + * @param message IntentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IntentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.verify|verify} messages. + * @param message IntentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IntentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IntentInfo + * @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.WebhookRequest.IntentInfo; + + /** + * Decodes an IntentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IntentInfo + * @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.WebhookRequest.IntentInfo; + + /** + * Verifies an IntentInfo 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 IntentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IntentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo; + + /** + * Creates a plain object from an IntentInfo message. Also converts values to other types if specified. + * @param message IntentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IntentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace IntentInfo { + + /** Properties of an IntentParameterValue. */ + interface IIntentParameterValue { + + /** IntentParameterValue originalValue */ + originalValue?: (string|null); + + /** IntentParameterValue resolvedValue */ + resolvedValue?: (google.protobuf.IValue|null); + } + + /** Represents an IntentParameterValue. */ + class IntentParameterValue implements IIntentParameterValue { + + /** + * Constructs a new IntentParameterValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue); + + /** IntentParameterValue originalValue. */ + public originalValue: string; + + /** IntentParameterValue resolvedValue. */ + public resolvedValue?: (google.protobuf.IValue|null); + + /** + * Creates a new IntentParameterValue instance using the specified properties. + * @param [properties] Properties to set + * @returns IntentParameterValue instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue): google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue; + + /** + * Encodes the specified IntentParameterValue message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.verify|verify} messages. + * @param message IntentParameterValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IntentParameterValue message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.verify|verify} messages. + * @param message IntentParameterValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IntentParameterValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IntentParameterValue + * @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.WebhookRequest.IntentInfo.IntentParameterValue; + + /** + * Decodes an IntentParameterValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IntentParameterValue + * @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.WebhookRequest.IntentInfo.IntentParameterValue; + + /** + * Verifies an IntentParameterValue 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 IntentParameterValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IntentParameterValue + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue; + + /** + * Creates a plain object from an IntentParameterValue message. Also converts values to other types if specified. + * @param message IntentParameterValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IntentParameterValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + + /** Properties of a WebhookResponse. */ + interface IWebhookResponse { + + /** WebhookResponse fulfillmentResponse */ + fulfillmentResponse?: (google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse|null); + + /** WebhookResponse pageInfo */ + pageInfo?: (google.cloud.dialogflow.cx.v3beta1.IPageInfo|null); + + /** WebhookResponse sessionInfo */ + sessionInfo?: (google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null); + + /** WebhookResponse payload */ + payload?: (google.protobuf.IStruct|null); + + /** WebhookResponse targetPage */ + targetPage?: (string|null); + + /** WebhookResponse targetFlow */ + targetFlow?: (string|null); + } + + /** Represents a WebhookResponse. */ + class WebhookResponse implements IWebhookResponse { + + /** + * Constructs a new WebhookResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IWebhookResponse); + + /** WebhookResponse fulfillmentResponse. */ + public fulfillmentResponse?: (google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse|null); + + /** WebhookResponse pageInfo. */ + public pageInfo?: (google.cloud.dialogflow.cx.v3beta1.IPageInfo|null); + + /** WebhookResponse sessionInfo. */ + public sessionInfo?: (google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null); + + /** WebhookResponse payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** WebhookResponse targetPage. */ + public targetPage: string; + + /** WebhookResponse targetFlow. */ + public targetFlow: string; + + /** WebhookResponse transition. */ + public transition?: ("targetPage"|"targetFlow"); + + /** + * Creates a new WebhookResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns WebhookResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IWebhookResponse): google.cloud.dialogflow.cx.v3beta1.WebhookResponse; + + /** + * Encodes the specified WebhookResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.verify|verify} messages. + * @param message WebhookResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IWebhookResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebhookResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.verify|verify} messages. + * @param message WebhookResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IWebhookResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebhookResponse + * @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.WebhookResponse; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebhookResponse + * @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.WebhookResponse; + + /** + * Verifies a WebhookResponse 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 a WebhookResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebhookResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.WebhookResponse; + + /** + * Creates a plain object from a WebhookResponse message. Also converts values to other types if specified. + * @param message WebhookResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.WebhookResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebhookResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WebhookResponse { + + /** Properties of a FulfillmentResponse. */ + interface IFulfillmentResponse { + + /** FulfillmentResponse messages */ + messages?: (google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]|null); + + /** FulfillmentResponse mergeBehavior */ + mergeBehavior?: (google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior|keyof typeof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior|null); + } + + /** Represents a FulfillmentResponse. */ + class FulfillmentResponse implements IFulfillmentResponse { + + /** + * Constructs a new FulfillmentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse); + + /** FulfillmentResponse messages. */ + public messages: google.cloud.dialogflow.cx.v3beta1.IResponseMessage[]; + + /** FulfillmentResponse mergeBehavior. */ + public mergeBehavior: (google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior|keyof typeof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior); + + /** + * Creates a new FulfillmentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns FulfillmentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse): google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse; + + /** + * Encodes the specified FulfillmentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.verify|verify} messages. + * @param message FulfillmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FulfillmentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.verify|verify} messages. + * @param message FulfillmentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FulfillmentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FulfillmentResponse + * @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.WebhookResponse.FulfillmentResponse; + + /** + * Decodes a FulfillmentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FulfillmentResponse + * @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.WebhookResponse.FulfillmentResponse; + + /** + * Verifies a FulfillmentResponse 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 a FulfillmentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FulfillmentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse; + + /** + * Creates a plain object from a FulfillmentResponse message. Also converts values to other types if specified. + * @param message FulfillmentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FulfillmentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FulfillmentResponse { + + /** MergeBehavior enum. */ + enum MergeBehavior { + MERGE_BEHAVIOR_UNSPECIFIED = 0, + APPEND = 1, + REPLACE = 2 + } + } + } + + /** Properties of a PageInfo. */ + interface IPageInfo { + + /** PageInfo currentPage */ + currentPage?: (string|null); + + /** PageInfo formInfo */ + formInfo?: (google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo|null); + } + + /** Represents a PageInfo. */ + class PageInfo implements IPageInfo { + + /** + * Constructs a new PageInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.IPageInfo); + + /** PageInfo currentPage. */ + public currentPage: string; + + /** PageInfo formInfo. */ + public formInfo?: (google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo|null); + + /** + * Creates a new PageInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PageInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.IPageInfo): google.cloud.dialogflow.cx.v3beta1.PageInfo; + + /** + * Encodes the specified PageInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.verify|verify} messages. + * @param message PageInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.IPageInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PageInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.verify|verify} messages. + * @param message PageInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.IPageInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PageInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PageInfo + * @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.PageInfo; + + /** + * Decodes a PageInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PageInfo + * @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.PageInfo; + + /** + * Verifies a PageInfo 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 a PageInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PageInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.PageInfo; + + /** + * Creates a plain object from a PageInfo message. Also converts values to other types if specified. + * @param message PageInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.PageInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PageInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PageInfo { + + /** Properties of a FormInfo. */ + interface IFormInfo { + + /** FormInfo parameterInfo */ + parameterInfo?: (google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo[]|null); + } + + /** Represents a FormInfo. */ + class FormInfo implements IFormInfo { + + /** + * Constructs a new FormInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo); + + /** FormInfo parameterInfo. */ + public parameterInfo: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo[]; + + /** + * Creates a new FormInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FormInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo): google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo; + + /** + * Encodes the specified FormInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.verify|verify} messages. + * @param message FormInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FormInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.verify|verify} messages. + * @param message FormInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FormInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FormInfo + * @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.PageInfo.FormInfo; + + /** + * Decodes a FormInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FormInfo + * @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.PageInfo.FormInfo; + + /** + * Verifies a FormInfo 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 a FormInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FormInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo; + + /** + * Creates a plain object from a FormInfo message. Also converts values to other types if specified. + * @param message FormInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FormInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FormInfo { + + /** Properties of a ParameterInfo. */ + interface IParameterInfo { + + /** ParameterInfo displayName */ + displayName?: (string|null); + + /** ParameterInfo required */ + required?: (boolean|null); + + /** ParameterInfo state */ + state?: (google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState|keyof typeof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState|null); + + /** ParameterInfo value */ + value?: (google.protobuf.IValue|null); + + /** ParameterInfo justCollected */ + justCollected?: (boolean|null); + } + + /** Represents a ParameterInfo. */ + class ParameterInfo implements IParameterInfo { + + /** + * Constructs a new ParameterInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo); + + /** ParameterInfo displayName. */ + public displayName: string; + + /** ParameterInfo required. */ + public required: boolean; + + /** ParameterInfo state. */ + public state: (google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState|keyof typeof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState); + + /** ParameterInfo value. */ + public value?: (google.protobuf.IValue|null); + + /** ParameterInfo justCollected. */ + public justCollected: boolean; + + /** + * Creates a new ParameterInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ParameterInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo): google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo; + + /** + * Encodes the specified ParameterInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.verify|verify} messages. + * @param message ParameterInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ParameterInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.verify|verify} messages. + * @param message ParameterInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ParameterInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ParameterInfo + * @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.PageInfo.FormInfo.ParameterInfo; + + /** + * Decodes a ParameterInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ParameterInfo + * @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.PageInfo.FormInfo.ParameterInfo; + + /** + * Verifies a ParameterInfo 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 a ParameterInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ParameterInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo; + + /** + * Creates a plain object from a ParameterInfo message. Also converts values to other types if specified. + * @param message ParameterInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ParameterInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ParameterInfo { + + /** ParameterState enum. */ + enum ParameterState { + PARAMETER_STATE_UNSPECIFIED = 0, + EMPTY = 1, + INVALID = 2, + FILLED = 3 + } + } + } + } + + /** Properties of a SessionInfo. */ + interface ISessionInfo { + + /** SessionInfo session */ + session?: (string|null); + + /** SessionInfo parameters */ + parameters?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a SessionInfo. */ + class SessionInfo implements ISessionInfo { + + /** + * Constructs a new SessionInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3beta1.ISessionInfo); + + /** SessionInfo session. */ + public session: string; + + /** SessionInfo parameters. */ + public parameters: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new SessionInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SessionInfo instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3beta1.ISessionInfo): google.cloud.dialogflow.cx.v3beta1.SessionInfo; + + /** + * Encodes the specified SessionInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionInfo.verify|verify} messages. + * @param message SessionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3beta1.ISessionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SessionInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionInfo.verify|verify} messages. + * @param message SessionInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3beta1.ISessionInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SessionInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SessionInfo + * @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.SessionInfo; + + /** + * Decodes a SessionInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SessionInfo + * @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.SessionInfo; + + /** + * Verifies a SessionInfo 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 a SessionInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SessionInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3beta1.SessionInfo; + + /** + * Creates a plain object from a SessionInfo message. Also converts values to other types if specified. + * @param message SessionInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3beta1.SessionInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SessionInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } } } } diff --git a/protos/protos.js b/protos/protos.js index ed45d180..01894d5e 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -39440,6 +39440,37461 @@ return v3; })(); + cx.v3beta1 = (function() { + + /** + * Namespace v3beta1. + * @memberof google.cloud.dialogflow.cx + * @namespace + */ + var v3beta1 = {}; + + v3beta1.Agents = (function() { + + /** + * Constructs a new Agents service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an Agents + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Agents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Agents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Agents; + + /** + * Creates new Agents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Agents} RPC service. Useful where requests and/or responses are streamed. + */ + Agents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#listAgents}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef ListAgentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse} [response] ListAgentsResponse + */ + + /** + * Calls ListAgents. + * @function listAgents + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest} request ListAgentsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.ListAgentsCallback} callback Node-style callback called with the error, if any, and ListAgentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.listAgents = function listAgents(request, callback) { + return this.rpcCall(listAgents, $root.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse, request, callback); + }, "name", { value: "ListAgents" }); + + /** + * Calls ListAgents. + * @function listAgents + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest} request ListAgentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#getAgent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef GetAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Agent} [response] Agent + */ + + /** + * Calls GetAgent. + * @function getAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest} request GetAgentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.GetAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.getAgent = function getAgent(request, callback) { + return this.rpcCall(getAgent, $root.google.cloud.dialogflow.cx.v3beta1.GetAgentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Agent, request, callback); + }, "name", { value: "GetAgent" }); + + /** + * Calls GetAgent. + * @function getAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest} request GetAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#createAgent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef CreateAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Agent} [response] Agent + */ + + /** + * Calls CreateAgent. + * @function createAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest} request CreateAgentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.CreateAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.createAgent = function createAgent(request, callback) { + return this.rpcCall(createAgent, $root.google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Agent, request, callback); + }, "name", { value: "CreateAgent" }); + + /** + * Calls CreateAgent. + * @function createAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest} request CreateAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#updateAgent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef UpdateAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Agent} [response] Agent + */ + + /** + * Calls UpdateAgent. + * @function updateAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest} request UpdateAgentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.updateAgent = function updateAgent(request, callback) { + return this.rpcCall(updateAgent, $root.google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Agent, request, callback); + }, "name", { value: "UpdateAgent" }); + + /** + * Calls UpdateAgent. + * @function updateAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest} request UpdateAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#deleteAgent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef DeleteAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteAgent. + * @function deleteAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest} request DeleteAgentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.DeleteAgentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.deleteAgent = function deleteAgent(request, callback) { + return this.rpcCall(deleteAgent, $root.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteAgent" }); + + /** + * Calls DeleteAgent. + * @function deleteAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest} request DeleteAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#exportAgent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef ExportAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportAgent. + * @function exportAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest} request ExportAgentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.exportAgent = function exportAgent(request, callback) { + return this.rpcCall(exportAgent, $root.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportAgent" }); + + /** + * Calls ExportAgent. + * @function exportAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest} request ExportAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Agents#restoreAgent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @typedef RestoreAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RestoreAgent. + * @function restoreAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest} request RestoreAgentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Agents.RestoreAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.restoreAgent = function restoreAgent(request, callback) { + return this.rpcCall(restoreAgent, $root.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RestoreAgent" }); + + /** + * Calls RestoreAgent. + * @function restoreAgent + * @memberof google.cloud.dialogflow.cx.v3beta1.Agents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest} request RestoreAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Agents; + })(); + + v3beta1.SpeechToTextSettings = (function() { + + /** + * Properties of a SpeechToTextSettings. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ISpeechToTextSettings + * @property {boolean|null} [enableSpeechAdaptation] SpeechToTextSettings enableSpeechAdaptation + */ + + /** + * Constructs a new SpeechToTextSettings. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SpeechToTextSettings. + * @implements ISpeechToTextSettings + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings=} [properties] Properties to set + */ + function SpeechToTextSettings(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]]; + } + + /** + * SpeechToTextSettings enableSpeechAdaptation. + * @member {boolean} enableSpeechAdaptation + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @instance + */ + SpeechToTextSettings.prototype.enableSpeechAdaptation = false; + + /** + * Creates a new SpeechToTextSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings} SpeechToTextSettings instance + */ + SpeechToTextSettings.create = function create(properties) { + return new SpeechToTextSettings(properties); + }; + + /** + * Encodes the specified SpeechToTextSettings message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings} message SpeechToTextSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechToTextSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableSpeechAdaptation != null && Object.hasOwnProperty.call(message, "enableSpeechAdaptation")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enableSpeechAdaptation); + return writer; + }; + + /** + * Encodes the specified SpeechToTextSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings} message SpeechToTextSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechToTextSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechToTextSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @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.SpeechToTextSettings} SpeechToTextSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechToTextSettings.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.SpeechToTextSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.enableSpeechAdaptation = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechToTextSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings} SpeechToTextSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechToTextSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechToTextSettings message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechToTextSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableSpeechAdaptation != null && message.hasOwnProperty("enableSpeechAdaptation")) + if (typeof message.enableSpeechAdaptation !== "boolean") + return "enableSpeechAdaptation: boolean expected"; + return null; + }; + + /** + * Creates a SpeechToTextSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings} SpeechToTextSettings + */ + SpeechToTextSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings(); + if (object.enableSpeechAdaptation != null) + message.enableSpeechAdaptation = Boolean(object.enableSpeechAdaptation); + return message; + }; + + /** + * Creates a plain object from a SpeechToTextSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings} message SpeechToTextSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechToTextSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.enableSpeechAdaptation = false; + if (message.enableSpeechAdaptation != null && message.hasOwnProperty("enableSpeechAdaptation")) + object.enableSpeechAdaptation = message.enableSpeechAdaptation; + return object; + }; + + /** + * Converts this SpeechToTextSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings + * @instance + * @returns {Object.} JSON object + */ + SpeechToTextSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SpeechToTextSettings; + })(); + + v3beta1.Agent = (function() { + + /** + * Properties of an Agent. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IAgent + * @property {string|null} [name] Agent name + * @property {string|null} [displayName] Agent displayName + * @property {string|null} [defaultLanguageCode] Agent defaultLanguageCode + * @property {string|null} [timeZone] Agent timeZone + * @property {string|null} [description] Agent description + * @property {string|null} [avatarUri] Agent avatarUri + * @property {google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings|null} [speechToTextSettings] Agent speechToTextSettings + * @property {string|null} [startFlow] Agent startFlow + * @property {boolean|null} [enableStackdriverLogging] Agent enableStackdriverLogging + * @property {boolean|null} [enableSpellCorrection] Agent enableSpellCorrection + */ + + /** + * Constructs a new Agent. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an Agent. + * @implements IAgent + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IAgent=} [properties] Properties to set + */ + function Agent(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]]; + } + + /** + * Agent name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.name = ""; + + /** + * Agent displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.displayName = ""; + + /** + * Agent defaultLanguageCode. + * @member {string} defaultLanguageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.defaultLanguageCode = ""; + + /** + * Agent timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.timeZone = ""; + + /** + * Agent description. + * @member {string} description + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.description = ""; + + /** + * Agent avatarUri. + * @member {string} avatarUri + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.avatarUri = ""; + + /** + * Agent speechToTextSettings. + * @member {google.cloud.dialogflow.cx.v3beta1.ISpeechToTextSettings|null|undefined} speechToTextSettings + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.speechToTextSettings = null; + + /** + * Agent startFlow. + * @member {string} startFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.startFlow = ""; + + /** + * Agent enableStackdriverLogging. + * @member {boolean} enableStackdriverLogging + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.enableStackdriverLogging = false; + + /** + * Agent enableSpellCorrection. + * @member {boolean} enableSpellCorrection + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + */ + Agent.prototype.enableSpellCorrection = false; + + /** + * Creates a new Agent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IAgent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Agent} Agent instance + */ + Agent.create = function create(properties) { + return new Agent(properties); + }; + + /** + * Encodes the specified Agent message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Agent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IAgent} message Agent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Agent.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + 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.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")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.description); + if (message.avatarUri != null && Object.hasOwnProperty.call(message, "avatarUri")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.avatarUri); + if (message.speechToTextSettings != null && Object.hasOwnProperty.call(message, "speechToTextSettings")) + $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.encode(message.speechToTextSettings, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.startFlow != null && Object.hasOwnProperty.call(message, "startFlow")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.startFlow); + if (message.enableStackdriverLogging != null && Object.hasOwnProperty.call(message, "enableStackdriverLogging")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.enableStackdriverLogging); + if (message.enableSpellCorrection != null && Object.hasOwnProperty.call(message, "enableSpellCorrection")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.enableSpellCorrection); + return writer; + }; + + /** + * Encodes the specified Agent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Agent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IAgent} message Agent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Agent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Agent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @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.Agent} Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Agent.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.Agent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.defaultLanguageCode = reader.string(); + break; + case 5: + message.timeZone = reader.string(); + break; + case 6: + message.description = reader.string(); + break; + case 7: + message.avatarUri = reader.string(); + break; + case 13: + message.speechToTextSettings = $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.decode(reader, reader.uint32()); + break; + case 16: + message.startFlow = reader.string(); + break; + case 18: + message.enableStackdriverLogging = reader.bool(); + break; + case 20: + message.enableSpellCorrection = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Agent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Agent} Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Agent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Agent message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Agent.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) + if (!$util.isString(message.defaultLanguageCode)) + return "defaultLanguageCode: string expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.avatarUri != null && message.hasOwnProperty("avatarUri")) + if (!$util.isString(message.avatarUri)) + return "avatarUri: string expected"; + if (message.speechToTextSettings != null && message.hasOwnProperty("speechToTextSettings")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.verify(message.speechToTextSettings); + if (error) + return "speechToTextSettings." + error; + } + if (message.startFlow != null && message.hasOwnProperty("startFlow")) + if (!$util.isString(message.startFlow)) + return "startFlow: string expected"; + if (message.enableStackdriverLogging != null && message.hasOwnProperty("enableStackdriverLogging")) + if (typeof message.enableStackdriverLogging !== "boolean") + return "enableStackdriverLogging: boolean expected"; + if (message.enableSpellCorrection != null && message.hasOwnProperty("enableSpellCorrection")) + if (typeof message.enableSpellCorrection !== "boolean") + return "enableSpellCorrection: boolean expected"; + return null; + }; + + /** + * Creates an Agent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Agent} Agent + */ + Agent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Agent) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Agent(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.defaultLanguageCode != null) + message.defaultLanguageCode = String(object.defaultLanguageCode); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.description != null) + message.description = String(object.description); + if (object.avatarUri != null) + message.avatarUri = String(object.avatarUri); + if (object.speechToTextSettings != null) { + if (typeof object.speechToTextSettings !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Agent.speechToTextSettings: object expected"); + message.speechToTextSettings = $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.fromObject(object.speechToTextSettings); + } + if (object.startFlow != null) + message.startFlow = String(object.startFlow); + if (object.enableStackdriverLogging != null) + message.enableStackdriverLogging = Boolean(object.enableStackdriverLogging); + if (object.enableSpellCorrection != null) + message.enableSpellCorrection = Boolean(object.enableSpellCorrection); + return message; + }; + + /** + * Creates a plain object from an Agent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Agent} message Agent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Agent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.defaultLanguageCode = ""; + object.timeZone = ""; + object.description = ""; + object.avatarUri = ""; + object.speechToTextSettings = null; + object.startFlow = ""; + object.enableStackdriverLogging = false; + object.enableSpellCorrection = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) + object.defaultLanguageCode = message.defaultLanguageCode; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.avatarUri != null && message.hasOwnProperty("avatarUri")) + object.avatarUri = message.avatarUri; + if (message.speechToTextSettings != null && message.hasOwnProperty("speechToTextSettings")) + object.speechToTextSettings = $root.google.cloud.dialogflow.cx.v3beta1.SpeechToTextSettings.toObject(message.speechToTextSettings, options); + if (message.startFlow != null && message.hasOwnProperty("startFlow")) + object.startFlow = message.startFlow; + if (message.enableStackdriverLogging != null && message.hasOwnProperty("enableStackdriverLogging")) + object.enableStackdriverLogging = message.enableStackdriverLogging; + if (message.enableSpellCorrection != null && message.hasOwnProperty("enableSpellCorrection")) + object.enableSpellCorrection = message.enableSpellCorrection; + return object; + }; + + /** + * Converts this Agent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Agent + * @instance + * @returns {Object.} JSON object + */ + Agent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Agent; + })(); + + v3beta1.ListAgentsRequest = (function() { + + /** + * Properties of a ListAgentsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListAgentsRequest + * @property {string|null} [parent] ListAgentsRequest parent + * @property {number|null} [pageSize] ListAgentsRequest pageSize + * @property {string|null} [pageToken] ListAgentsRequest pageToken + */ + + /** + * Constructs a new ListAgentsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListAgentsRequest. + * @implements IListAgentsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest=} [properties] Properties to set + */ + function ListAgentsRequest(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]]; + } + + /** + * ListAgentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @instance + */ + ListAgentsRequest.prototype.parent = ""; + + /** + * ListAgentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @instance + */ + ListAgentsRequest.prototype.pageSize = 0; + + /** + * ListAgentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @instance + */ + ListAgentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListAgentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest} ListAgentsRequest instance + */ + ListAgentsRequest.create = function create(properties) { + return new ListAgentsRequest(properties); + }; + + /** + * Encodes the specified ListAgentsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest} message ListAgentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAgentsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListAgentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest} message ListAgentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAgentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAgentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @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.ListAgentsRequest} ListAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAgentsRequest.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.ListAgentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAgentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest} ListAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAgentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAgentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAgentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListAgentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest} ListAgentsRequest + */ + ListAgentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListAgentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest} message ListAgentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAgentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListAgentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListAgentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListAgentsRequest; + })(); + + v3beta1.ListAgentsResponse = (function() { + + /** + * Properties of a ListAgentsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListAgentsResponse + * @property {Array.|null} [agents] ListAgentsResponse agents + * @property {string|null} [nextPageToken] ListAgentsResponse nextPageToken + */ + + /** + * Constructs a new ListAgentsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListAgentsResponse. + * @implements IListAgentsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse=} [properties] Properties to set + */ + function ListAgentsResponse(properties) { + this.agents = []; + 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]]; + } + + /** + * ListAgentsResponse agents. + * @member {Array.} agents + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @instance + */ + ListAgentsResponse.prototype.agents = $util.emptyArray; + + /** + * ListAgentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @instance + */ + ListAgentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListAgentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse} ListAgentsResponse instance + */ + ListAgentsResponse.create = function create(properties) { + return new ListAgentsResponse(properties); + }; + + /** + * Encodes the specified ListAgentsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse} message ListAgentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAgentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agents != null && message.agents.length) + for (var i = 0; i < message.agents.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Agent.encode(message.agents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListAgentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse} message ListAgentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAgentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAgentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @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.ListAgentsResponse} ListAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAgentsResponse.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.ListAgentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.agents && message.agents.length)) + message.agents = []; + message.agents.push($root.google.cloud.dialogflow.cx.v3beta1.Agent.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAgentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse} ListAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAgentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAgentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAgentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agents != null && message.hasOwnProperty("agents")) { + if (!Array.isArray(message.agents)) + return "agents: array expected"; + for (var i = 0; i < message.agents.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Agent.verify(message.agents[i]); + if (error) + return "agents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListAgentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse} ListAgentsResponse + */ + ListAgentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse(); + if (object.agents) { + if (!Array.isArray(object.agents)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse.agents: array expected"); + message.agents = []; + for (var i = 0; i < object.agents.length; ++i) { + if (typeof object.agents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse.agents: object expected"); + message.agents[i] = $root.google.cloud.dialogflow.cx.v3beta1.Agent.fromObject(object.agents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListAgentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse} message ListAgentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAgentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.agents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.agents && message.agents.length) { + object.agents = []; + for (var j = 0; j < message.agents.length; ++j) + object.agents[j] = $root.google.cloud.dialogflow.cx.v3beta1.Agent.toObject(message.agents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListAgentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListAgentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListAgentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListAgentsResponse; + })(); + + v3beta1.GetAgentRequest = (function() { + + /** + * Properties of a GetAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetAgentRequest + * @property {string|null} [name] GetAgentRequest name + */ + + /** + * Constructs a new GetAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetAgentRequest. + * @implements IGetAgentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest=} [properties] Properties to set + */ + function GetAgentRequest(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]]; + } + + /** + * GetAgentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @instance + */ + GetAgentRequest.prototype.name = ""; + + /** + * Creates a new GetAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetAgentRequest} GetAgentRequest instance + */ + GetAgentRequest.create = function create(properties) { + return new GetAgentRequest(properties); + }; + + /** + * Encodes the specified GetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest} message GetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified GetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest} message GetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @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.GetAgentRequest} GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAgentRequest.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.GetAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetAgentRequest} GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAgentRequest.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"; + return null; + }; + + /** + * Creates a GetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetAgentRequest} GetAgentRequest + */ + GetAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetAgentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetAgentRequest} message GetAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetAgentRequest + * @instance + * @returns {Object.} JSON object + */ + GetAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetAgentRequest; + })(); + + v3beta1.CreateAgentRequest = (function() { + + /** + * Properties of a CreateAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateAgentRequest + * @property {string|null} [parent] CreateAgentRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IAgent|null} [agent] CreateAgentRequest agent + */ + + /** + * Constructs a new CreateAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateAgentRequest. + * @implements ICreateAgentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest=} [properties] Properties to set + */ + function CreateAgentRequest(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]]; + } + + /** + * CreateAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @instance + */ + CreateAgentRequest.prototype.parent = ""; + + /** + * CreateAgentRequest agent. + * @member {google.cloud.dialogflow.cx.v3beta1.IAgent|null|undefined} agent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @instance + */ + CreateAgentRequest.prototype.agent = null; + + /** + * Creates a new CreateAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest} CreateAgentRequest instance + */ + CreateAgentRequest.create = function create(properties) { + return new CreateAgentRequest(properties); + }; + + /** + * Encodes the specified CreateAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest} message CreateAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAgentRequest.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.agent != null && Object.hasOwnProperty.call(message, "agent")) + $root.google.cloud.dialogflow.cx.v3beta1.Agent.encode(message.agent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest} message CreateAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @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.CreateAgentRequest} CreateAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAgentRequest.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.CreateAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.agent = $root.google.cloud.dialogflow.cx.v3beta1.Agent.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest} CreateAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.agent != null && message.hasOwnProperty("agent")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Agent.verify(message.agent); + if (error) + return "agent." + error; + } + return null; + }; + + /** + * Creates a CreateAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest} CreateAgentRequest + */ + CreateAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agent != null) { + if (typeof object.agent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest.agent: object expected"); + message.agent = $root.google.cloud.dialogflow.cx.v3beta1.Agent.fromObject(object.agent); + } + return message; + }; + + /** + * Creates a plain object from a CreateAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest} message CreateAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.agent = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = $root.google.cloud.dialogflow.cx.v3beta1.Agent.toObject(message.agent, options); + return object; + }; + + /** + * Converts this CreateAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateAgentRequest; + })(); + + v3beta1.UpdateAgentRequest = (function() { + + /** + * Properties of an UpdateAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateAgentRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IAgent|null} [agent] UpdateAgentRequest agent + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAgentRequest updateMask + */ + + /** + * Constructs a new UpdateAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateAgentRequest. + * @implements IUpdateAgentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest=} [properties] Properties to set + */ + function UpdateAgentRequest(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]]; + } + + /** + * UpdateAgentRequest agent. + * @member {google.cloud.dialogflow.cx.v3beta1.IAgent|null|undefined} agent + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @instance + */ + UpdateAgentRequest.prototype.agent = null; + + /** + * UpdateAgentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @instance + */ + UpdateAgentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest} UpdateAgentRequest instance + */ + UpdateAgentRequest.create = function create(properties) { + return new UpdateAgentRequest(properties); + }; + + /** + * Encodes the specified UpdateAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest} message UpdateAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAgentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + $root.google.cloud.dialogflow.cx.v3beta1.Agent.encode(message.agent, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest} message UpdateAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @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.UpdateAgentRequest} UpdateAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAgentRequest.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.UpdateAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.agent = $root.google.cloud.dialogflow.cx.v3beta1.Agent.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest} UpdateAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Agent.verify(message.agent); + if (error) + return "agent." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest} UpdateAgentRequest + */ + UpdateAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest(); + if (object.agent != null) { + if (typeof object.agent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest.agent: object expected"); + message.agent = $root.google.cloud.dialogflow.cx.v3beta1.Agent.fromObject(object.agent); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest} message UpdateAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.agent = null; + object.updateMask = null; + } + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = $root.google.cloud.dialogflow.cx.v3beta1.Agent.toObject(message.agent, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateAgentRequest; + })(); + + v3beta1.DeleteAgentRequest = (function() { + + /** + * Properties of a DeleteAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteAgentRequest + * @property {string|null} [name] DeleteAgentRequest name + */ + + /** + * Constructs a new DeleteAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteAgentRequest. + * @implements IDeleteAgentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest=} [properties] Properties to set + */ + function DeleteAgentRequest(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]]; + } + + /** + * DeleteAgentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @instance + */ + DeleteAgentRequest.prototype.name = ""; + + /** + * Creates a new DeleteAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest} DeleteAgentRequest instance + */ + DeleteAgentRequest.create = function create(properties) { + return new DeleteAgentRequest(properties); + }; + + /** + * Encodes the specified DeleteAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest} message DeleteAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest} message DeleteAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @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.DeleteAgentRequest} DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAgentRequest.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.DeleteAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest} DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteAgentRequest.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"; + return null; + }; + + /** + * Creates a DeleteAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest} DeleteAgentRequest + */ + DeleteAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest} message DeleteAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteAgentRequest; + })(); + + v3beta1.ExportAgentRequest = (function() { + + /** + * Properties of an ExportAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IExportAgentRequest + * @property {string|null} [name] ExportAgentRequest name + * @property {string|null} [agentUri] ExportAgentRequest agentUri + */ + + /** + * Constructs a new ExportAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an ExportAgentRequest. + * @implements IExportAgentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest=} [properties] Properties to set + */ + function ExportAgentRequest(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]]; + } + + /** + * ExportAgentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.name = ""; + + /** + * ExportAgentRequest agentUri. + * @member {string} agentUri + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.agentUri = ""; + + /** + * Creates a new ExportAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest} ExportAgentRequest instance + */ + ExportAgentRequest.create = function create(properties) { + return new ExportAgentRequest(properties); + }; + + /** + * Encodes the specified ExportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest} message ExportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + return writer; + }; + + /** + * Encodes the specified ExportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest} message ExportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @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.ExportAgentRequest} ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentRequest.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.ExportAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.agentUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest} ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAgentRequest.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.agentUri != null && message.hasOwnProperty("agentUri")) + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + return null; + }; + + /** + * Creates an ExportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest} ExportAgentRequest + */ + ExportAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + return message; + }; + + /** + * Creates a plain object from an ExportAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest} message ExportAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.agentUri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) + object.agentUri = message.agentUri; + return object; + }; + + /** + * Converts this ExportAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest + * @instance + * @returns {Object.} JSON object + */ + ExportAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportAgentRequest; + })(); + + v3beta1.ExportAgentResponse = (function() { + + /** + * Properties of an ExportAgentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IExportAgentResponse + * @property {string|null} [agentUri] ExportAgentResponse agentUri + * @property {Uint8Array|null} [agentContent] ExportAgentResponse agentContent + */ + + /** + * Constructs a new ExportAgentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an ExportAgentResponse. + * @implements IExportAgentResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse=} [properties] Properties to set + */ + function ExportAgentResponse(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]]; + } + + /** + * ExportAgentResponse agentUri. + * @member {string} agentUri + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @instance + */ + ExportAgentResponse.prototype.agentUri = ""; + + /** + * ExportAgentResponse agentContent. + * @member {Uint8Array} agentContent + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @instance + */ + ExportAgentResponse.prototype.agentContent = $util.newBuffer([]); + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportAgentResponse agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @instance + */ + Object.defineProperty(ExportAgentResponse.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportAgentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse} ExportAgentResponse instance + */ + ExportAgentResponse.create = function create(properties) { + return new ExportAgentResponse(properties); + }; + + /** + * Encodes the specified ExportAgentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse} message ExportAgentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified ExportAgentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse} message ExportAgentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @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.ExportAgentResponse} ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentResponse.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.ExportAgentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.agentUri = reader.string(); + break; + case 2: + message.agentContent = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse} ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAgentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAgentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates an ExportAgentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse} ExportAgentResponse + */ + ExportAgentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse(); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from an ExportAgentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse} message ExportAgentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAgentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this ExportAgentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse + * @instance + * @returns {Object.} JSON object + */ + ExportAgentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportAgentResponse; + })(); + + v3beta1.RestoreAgentRequest = (function() { + + /** + * Properties of a RestoreAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IRestoreAgentRequest + * @property {string|null} [name] RestoreAgentRequest name + * @property {string|null} [agentUri] RestoreAgentRequest agentUri + * @property {Uint8Array|null} [agentContent] RestoreAgentRequest agentContent + */ + + /** + * Constructs a new RestoreAgentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a RestoreAgentRequest. + * @implements IRestoreAgentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest=} [properties] Properties to set + */ + function RestoreAgentRequest(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]]; + } + + /** + * RestoreAgentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.name = ""; + + /** + * RestoreAgentRequest agentUri. + * @member {string} agentUri + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.agentUri = ""; + + /** + * RestoreAgentRequest agentContent. + * @member {Uint8Array} agentContent + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.agentContent = $util.newBuffer([]); + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RestoreAgentRequest agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @instance + */ + Object.defineProperty(RestoreAgentRequest.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RestoreAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest} RestoreAgentRequest instance + */ + RestoreAgentRequest.create = function create(properties) { + return new RestoreAgentRequest(properties); + }; + + /** + * Encodes the specified RestoreAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest} message RestoreAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified RestoreAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest} message RestoreAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @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.RestoreAgentRequest} RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreAgentRequest.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.RestoreAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.agentUri = reader.string(); + break; + case 3: + message.agentContent = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest} RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates a RestoreAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest} RestoreAgentRequest + */ + RestoreAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from a RestoreAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest} message RestoreAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this RestoreAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest + * @instance + * @returns {Object.} JSON object + */ + RestoreAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RestoreAgentRequest; + })(); + + v3beta1.Flows = (function() { + + /** + * Constructs a new Flows service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Flows + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Flows(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Flows.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Flows; + + /** + * Creates new Flows service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Flows} RPC service. Useful where requests and/or responses are streamed. + */ + Flows.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#createFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef CreateFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Flow} [response] Flow + */ + + /** + * Calls CreateFlow. + * @function createFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest} request CreateFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.CreateFlowCallback} callback Node-style callback called with the error, if any, and Flow + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.createFlow = function createFlow(request, callback) { + return this.rpcCall(createFlow, $root.google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest, $root.google.cloud.dialogflow.cx.v3beta1.Flow, request, callback); + }, "name", { value: "CreateFlow" }); + + /** + * Calls CreateFlow. + * @function createFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest} request CreateFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#deleteFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef DeleteFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteFlow. + * @function deleteFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest} request DeleteFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.DeleteFlowCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.deleteFlow = function deleteFlow(request, callback) { + return this.rpcCall(deleteFlow, $root.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteFlow" }); + + /** + * Calls DeleteFlow. + * @function deleteFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest} request DeleteFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#listFlows}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef ListFlowsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse} [response] ListFlowsResponse + */ + + /** + * Calls ListFlows. + * @function listFlows + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest} request ListFlowsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.ListFlowsCallback} callback Node-style callback called with the error, if any, and ListFlowsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.listFlows = function listFlows(request, callback) { + return this.rpcCall(listFlows, $root.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse, request, callback); + }, "name", { value: "ListFlows" }); + + /** + * Calls ListFlows. + * @function listFlows + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest} request ListFlowsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#getFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef GetFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Flow} [response] Flow + */ + + /** + * Calls GetFlow. + * @function getFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest} request GetFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.GetFlowCallback} callback Node-style callback called with the error, if any, and Flow + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.getFlow = function getFlow(request, callback) { + return this.rpcCall(getFlow, $root.google.cloud.dialogflow.cx.v3beta1.GetFlowRequest, $root.google.cloud.dialogflow.cx.v3beta1.Flow, request, callback); + }, "name", { value: "GetFlow" }); + + /** + * Calls GetFlow. + * @function getFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest} request GetFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#updateFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef UpdateFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Flow} [response] Flow + */ + + /** + * Calls UpdateFlow. + * @function updateFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest} request UpdateFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.UpdateFlowCallback} callback Node-style callback called with the error, if any, and Flow + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.updateFlow = function updateFlow(request, callback) { + return this.rpcCall(updateFlow, $root.google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest, $root.google.cloud.dialogflow.cx.v3beta1.Flow, request, callback); + }, "name", { value: "UpdateFlow" }); + + /** + * Calls UpdateFlow. + * @function updateFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest} request UpdateFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Flows#trainFlow}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @typedef TrainFlowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls TrainFlow. + * @function trainFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest} request TrainFlowRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Flows.TrainFlowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Flows.prototype.trainFlow = function trainFlow(request, callback) { + return this.rpcCall(trainFlow, $root.google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "TrainFlow" }); + + /** + * Calls TrainFlow. + * @function trainFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.Flows + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest} request TrainFlowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Flows; + })(); + + v3beta1.NluSettings = (function() { + + /** + * Properties of a NluSettings. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface INluSettings + * @property {google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType|null} [modelType] NluSettings modelType + * @property {number|null} [classificationThreshold] NluSettings classificationThreshold + * @property {google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode|null} [modelTrainingMode] NluSettings modelTrainingMode + */ + + /** + * Constructs a new NluSettings. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a NluSettings. + * @implements INluSettings + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.INluSettings=} [properties] Properties to set + */ + function NluSettings(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]]; + } + + /** + * NluSettings modelType. + * @member {google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType} modelType + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @instance + */ + NluSettings.prototype.modelType = 0; + + /** + * NluSettings classificationThreshold. + * @member {number} classificationThreshold + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @instance + */ + NluSettings.prototype.classificationThreshold = 0; + + /** + * NluSettings modelTrainingMode. + * @member {google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode} modelTrainingMode + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @instance + */ + NluSettings.prototype.modelTrainingMode = 0; + + /** + * Creates a new NluSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.INluSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.NluSettings} NluSettings instance + */ + NluSettings.create = function create(properties) { + return new NluSettings(properties); + }; + + /** + * Encodes the specified NluSettings message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.NluSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.INluSettings} message NluSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NluSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.modelType != null && Object.hasOwnProperty.call(message, "modelType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.modelType); + if (message.classificationThreshold != null && Object.hasOwnProperty.call(message, "classificationThreshold")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.classificationThreshold); + if (message.modelTrainingMode != null && Object.hasOwnProperty.call(message, "modelTrainingMode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.modelTrainingMode); + return writer; + }; + + /** + * Encodes the specified NluSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.NluSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.INluSettings} message NluSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NluSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NluSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @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.NluSettings} NluSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NluSettings.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.NluSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.modelType = reader.int32(); + break; + case 3: + message.classificationThreshold = reader.float(); + break; + case 4: + message.modelTrainingMode = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NluSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.NluSettings} NluSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NluSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NluSettings message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NluSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.modelType != null && message.hasOwnProperty("modelType")) + switch (message.modelType) { + default: + return "modelType: enum value expected"; + case 0: + case 1: + case 3: + break; + } + if (message.classificationThreshold != null && message.hasOwnProperty("classificationThreshold")) + if (typeof message.classificationThreshold !== "number") + return "classificationThreshold: number expected"; + if (message.modelTrainingMode != null && message.hasOwnProperty("modelTrainingMode")) + switch (message.modelTrainingMode) { + default: + return "modelTrainingMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a NluSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.NluSettings} NluSettings + */ + NluSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.NluSettings) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.NluSettings(); + switch (object.modelType) { + case "MODEL_TYPE_UNSPECIFIED": + case 0: + message.modelType = 0; + break; + case "MODEL_TYPE_STANDARD": + case 1: + message.modelType = 1; + break; + case "MODEL_TYPE_ADVANCED": + case 3: + message.modelType = 3; + break; + } + if (object.classificationThreshold != null) + message.classificationThreshold = Number(object.classificationThreshold); + switch (object.modelTrainingMode) { + case "MODEL_TRAINING_MODE_UNSPECIFIED": + case 0: + message.modelTrainingMode = 0; + break; + case "MODEL_TRAINING_MODE_AUTOMATIC": + case 1: + message.modelTrainingMode = 1; + break; + case "MODEL_TRAINING_MODE_MANUAL": + case 2: + message.modelTrainingMode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a NluSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.NluSettings} message NluSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NluSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.modelType = options.enums === String ? "MODEL_TYPE_UNSPECIFIED" : 0; + object.classificationThreshold = 0; + object.modelTrainingMode = options.enums === String ? "MODEL_TRAINING_MODE_UNSPECIFIED" : 0; + } + if (message.modelType != null && message.hasOwnProperty("modelType")) + object.modelType = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType[message.modelType] : message.modelType; + if (message.classificationThreshold != null && message.hasOwnProperty("classificationThreshold")) + object.classificationThreshold = options.json && !isFinite(message.classificationThreshold) ? String(message.classificationThreshold) : message.classificationThreshold; + if (message.modelTrainingMode != null && message.hasOwnProperty("modelTrainingMode")) + object.modelTrainingMode = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode[message.modelTrainingMode] : message.modelTrainingMode; + return object; + }; + + /** + * Converts this NluSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.NluSettings + * @instance + * @returns {Object.} JSON object + */ + NluSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ModelType enum. + * @name google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelType + * @enum {number} + * @property {number} MODEL_TYPE_UNSPECIFIED=0 MODEL_TYPE_UNSPECIFIED value + * @property {number} MODEL_TYPE_STANDARD=1 MODEL_TYPE_STANDARD value + * @property {number} MODEL_TYPE_ADVANCED=3 MODEL_TYPE_ADVANCED value + */ + NluSettings.ModelType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODEL_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MODEL_TYPE_STANDARD"] = 1; + values[valuesById[3] = "MODEL_TYPE_ADVANCED"] = 3; + return values; + })(); + + /** + * ModelTrainingMode enum. + * @name google.cloud.dialogflow.cx.v3beta1.NluSettings.ModelTrainingMode + * @enum {number} + * @property {number} MODEL_TRAINING_MODE_UNSPECIFIED=0 MODEL_TRAINING_MODE_UNSPECIFIED value + * @property {number} MODEL_TRAINING_MODE_AUTOMATIC=1 MODEL_TRAINING_MODE_AUTOMATIC value + * @property {number} MODEL_TRAINING_MODE_MANUAL=2 MODEL_TRAINING_MODE_MANUAL value + */ + NluSettings.ModelTrainingMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODEL_TRAINING_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MODEL_TRAINING_MODE_AUTOMATIC"] = 1; + values[valuesById[2] = "MODEL_TRAINING_MODE_MANUAL"] = 2; + return values; + })(); + + return NluSettings; + })(); + + v3beta1.Flow = (function() { + + /** + * Properties of a Flow. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IFlow + * @property {string|null} [name] Flow name + * @property {string|null} [displayName] Flow displayName + * @property {string|null} [description] Flow description + * @property {Array.|null} [transitionRoutes] Flow transitionRoutes + * @property {Array.|null} [eventHandlers] Flow eventHandlers + * @property {google.cloud.dialogflow.cx.v3beta1.INluSettings|null} [nluSettings] Flow nluSettings + */ + + /** + * Constructs a new Flow. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Flow. + * @implements IFlow + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IFlow=} [properties] Properties to set + */ + function Flow(properties) { + this.transitionRoutes = []; + this.eventHandlers = []; + 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]]; + } + + /** + * Flow name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + */ + Flow.prototype.name = ""; + + /** + * Flow displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + */ + Flow.prototype.displayName = ""; + + /** + * Flow description. + * @member {string} description + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + */ + Flow.prototype.description = ""; + + /** + * Flow transitionRoutes. + * @member {Array.} transitionRoutes + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + */ + Flow.prototype.transitionRoutes = $util.emptyArray; + + /** + * Flow eventHandlers. + * @member {Array.} eventHandlers + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + */ + Flow.prototype.eventHandlers = $util.emptyArray; + + /** + * Flow nluSettings. + * @member {google.cloud.dialogflow.cx.v3beta1.INluSettings|null|undefined} nluSettings + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + */ + Flow.prototype.nluSettings = null; + + /** + * Creates a new Flow instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFlow=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Flow} Flow instance + */ + Flow.create = function create(properties) { + return new Flow(properties); + }; + + /** + * Encodes the specified Flow message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Flow.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFlow} message Flow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Flow.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.transitionRoutes != null && message.transitionRoutes.length) + for (var i = 0; i < message.transitionRoutes.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.encode(message.transitionRoutes[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.eventHandlers != null && message.eventHandlers.length) + for (var i = 0; i < message.eventHandlers.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.encode(message.eventHandlers[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.nluSettings != null && Object.hasOwnProperty.call(message, "nluSettings")) + $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.encode(message.nluSettings, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Flow message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Flow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFlow} message Flow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Flow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Flow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @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.Flow} Flow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Flow.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.Flow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + if (!(message.transitionRoutes && message.transitionRoutes.length)) + message.transitionRoutes = []; + message.transitionRoutes.push($root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.eventHandlers && message.eventHandlers.length)) + message.eventHandlers = []; + message.eventHandlers.push($root.google.cloud.dialogflow.cx.v3beta1.EventHandler.decode(reader, reader.uint32())); + break; + case 11: + message.nluSettings = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Flow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Flow} Flow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Flow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Flow message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Flow.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.transitionRoutes != null && message.hasOwnProperty("transitionRoutes")) { + if (!Array.isArray(message.transitionRoutes)) + return "transitionRoutes: array expected"; + for (var i = 0; i < message.transitionRoutes.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify(message.transitionRoutes[i]); + if (error) + return "transitionRoutes." + error; + } + } + if (message.eventHandlers != null && message.hasOwnProperty("eventHandlers")) { + if (!Array.isArray(message.eventHandlers)) + return "eventHandlers: array expected"; + for (var i = 0; i < message.eventHandlers.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.verify(message.eventHandlers[i]); + if (error) + return "eventHandlers." + error; + } + } + if (message.nluSettings != null && message.hasOwnProperty("nluSettings")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.verify(message.nluSettings); + if (error) + return "nluSettings." + error; + } + return null; + }; + + /** + * Creates a Flow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Flow} Flow + */ + Flow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Flow) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Flow(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.transitionRoutes) { + if (!Array.isArray(object.transitionRoutes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Flow.transitionRoutes: array expected"); + message.transitionRoutes = []; + for (var i = 0; i < object.transitionRoutes.length; ++i) { + if (typeof object.transitionRoutes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Flow.transitionRoutes: object expected"); + message.transitionRoutes[i] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.fromObject(object.transitionRoutes[i]); + } + } + if (object.eventHandlers) { + if (!Array.isArray(object.eventHandlers)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Flow.eventHandlers: array expected"); + message.eventHandlers = []; + for (var i = 0; i < object.eventHandlers.length; ++i) { + if (typeof object.eventHandlers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Flow.eventHandlers: object expected"); + message.eventHandlers[i] = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.fromObject(object.eventHandlers[i]); + } + } + if (object.nluSettings != null) { + if (typeof object.nluSettings !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Flow.nluSettings: object expected"); + message.nluSettings = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.fromObject(object.nluSettings); + } + return message; + }; + + /** + * Creates a plain object from a Flow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Flow} message Flow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Flow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.transitionRoutes = []; + object.eventHandlers = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + object.nluSettings = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.transitionRoutes && message.transitionRoutes.length) { + object.transitionRoutes = []; + for (var j = 0; j < message.transitionRoutes.length; ++j) + object.transitionRoutes[j] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.toObject(message.transitionRoutes[j], options); + } + if (message.eventHandlers && message.eventHandlers.length) { + object.eventHandlers = []; + for (var j = 0; j < message.eventHandlers.length; ++j) + object.eventHandlers[j] = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.toObject(message.eventHandlers[j], options); + } + if (message.nluSettings != null && message.hasOwnProperty("nluSettings")) + object.nluSettings = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.toObject(message.nluSettings, options); + return object; + }; + + /** + * Converts this Flow to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Flow + * @instance + * @returns {Object.} JSON object + */ + Flow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Flow; + })(); + + v3beta1.CreateFlowRequest = (function() { + + /** + * Properties of a CreateFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateFlowRequest + * @property {string|null} [parent] CreateFlowRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IFlow|null} [flow] CreateFlowRequest flow + * @property {string|null} [languageCode] CreateFlowRequest languageCode + */ + + /** + * Constructs a new CreateFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateFlowRequest. + * @implements ICreateFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest=} [properties] Properties to set + */ + function CreateFlowRequest(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]]; + } + + /** + * CreateFlowRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @instance + */ + CreateFlowRequest.prototype.parent = ""; + + /** + * CreateFlowRequest flow. + * @member {google.cloud.dialogflow.cx.v3beta1.IFlow|null|undefined} flow + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @instance + */ + CreateFlowRequest.prototype.flow = null; + + /** + * CreateFlowRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @instance + */ + CreateFlowRequest.prototype.languageCode = ""; + + /** + * Creates a new CreateFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest} CreateFlowRequest instance + */ + CreateFlowRequest.create = function create(properties) { + return new CreateFlowRequest(properties); + }; + + /** + * Encodes the specified CreateFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest} message CreateFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFlowRequest.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.flow != null && Object.hasOwnProperty.call(message, "flow")) + $root.google.cloud.dialogflow.cx.v3beta1.Flow.encode(message.flow, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreateFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest} message CreateFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @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.CreateFlowRequest} CreateFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFlowRequest.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.CreateFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.flow = $root.google.cloud.dialogflow.cx.v3beta1.Flow.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest} CreateFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateFlowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.flow != null && message.hasOwnProperty("flow")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Flow.verify(message.flow); + if (error) + return "flow." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreateFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest} CreateFlowRequest + */ + CreateFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.flow != null) { + if (typeof object.flow !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest.flow: object expected"); + message.flow = $root.google.cloud.dialogflow.cx.v3beta1.Flow.fromObject(object.flow); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreateFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest} message CreateFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.flow = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.flow != null && message.hasOwnProperty("flow")) + object.flow = $root.google.cloud.dialogflow.cx.v3beta1.Flow.toObject(message.flow, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreateFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest + * @instance + * @returns {Object.} JSON object + */ + CreateFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateFlowRequest; + })(); + + v3beta1.DeleteFlowRequest = (function() { + + /** + * Properties of a DeleteFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteFlowRequest + * @property {string|null} [name] DeleteFlowRequest name + * @property {boolean|null} [force] DeleteFlowRequest force + */ + + /** + * Constructs a new DeleteFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteFlowRequest. + * @implements IDeleteFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest=} [properties] Properties to set + */ + function DeleteFlowRequest(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]]; + } + + /** + * DeleteFlowRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @instance + */ + DeleteFlowRequest.prototype.name = ""; + + /** + * DeleteFlowRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @instance + */ + DeleteFlowRequest.prototype.force = false; + + /** + * Creates a new DeleteFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest} DeleteFlowRequest instance + */ + DeleteFlowRequest.create = function create(properties) { + return new DeleteFlowRequest(properties); + }; + + /** + * Encodes the specified DeleteFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest} message DeleteFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFlowRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest} message DeleteFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @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.DeleteFlowRequest} DeleteFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFlowRequest.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.DeleteFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest} DeleteFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteFlowRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest} DeleteFlowRequest + */ + DeleteFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest} message DeleteFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteFlowRequest; + })(); + + v3beta1.ListFlowsRequest = (function() { + + /** + * Properties of a ListFlowsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListFlowsRequest + * @property {string|null} [parent] ListFlowsRequest parent + * @property {number|null} [pageSize] ListFlowsRequest pageSize + * @property {string|null} [pageToken] ListFlowsRequest pageToken + * @property {string|null} [languageCode] ListFlowsRequest languageCode + */ + + /** + * Constructs a new ListFlowsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListFlowsRequest. + * @implements IListFlowsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest=} [properties] Properties to set + */ + function ListFlowsRequest(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]]; + } + + /** + * ListFlowsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @instance + */ + ListFlowsRequest.prototype.parent = ""; + + /** + * ListFlowsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @instance + */ + ListFlowsRequest.prototype.pageSize = 0; + + /** + * ListFlowsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @instance + */ + ListFlowsRequest.prototype.pageToken = ""; + + /** + * ListFlowsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @instance + */ + ListFlowsRequest.prototype.languageCode = ""; + + /** + * Creates a new ListFlowsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest} ListFlowsRequest instance + */ + ListFlowsRequest.create = function create(properties) { + return new ListFlowsRequest(properties); + }; + + /** + * Encodes the specified ListFlowsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest} message ListFlowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFlowsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified ListFlowsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest} message ListFlowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFlowsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFlowsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @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.ListFlowsRequest} ListFlowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFlowsRequest.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.ListFlowsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFlowsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest} ListFlowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFlowsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFlowsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFlowsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a ListFlowsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest} ListFlowsRequest + */ + ListFlowsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a ListFlowsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest} message ListFlowsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFlowsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this ListFlowsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest + * @instance + * @returns {Object.} JSON object + */ + ListFlowsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFlowsRequest; + })(); + + v3beta1.ListFlowsResponse = (function() { + + /** + * Properties of a ListFlowsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListFlowsResponse + * @property {Array.|null} [flows] ListFlowsResponse flows + * @property {string|null} [nextPageToken] ListFlowsResponse nextPageToken + */ + + /** + * Constructs a new ListFlowsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListFlowsResponse. + * @implements IListFlowsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse=} [properties] Properties to set + */ + function ListFlowsResponse(properties) { + this.flows = []; + 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]]; + } + + /** + * ListFlowsResponse flows. + * @member {Array.} flows + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @instance + */ + ListFlowsResponse.prototype.flows = $util.emptyArray; + + /** + * ListFlowsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @instance + */ + ListFlowsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListFlowsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse} ListFlowsResponse instance + */ + ListFlowsResponse.create = function create(properties) { + return new ListFlowsResponse(properties); + }; + + /** + * Encodes the specified ListFlowsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse} message ListFlowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFlowsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.flows != null && message.flows.length) + for (var i = 0; i < message.flows.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Flow.encode(message.flows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListFlowsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse} message ListFlowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListFlowsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListFlowsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @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.ListFlowsResponse} ListFlowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFlowsResponse.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.ListFlowsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.flows && message.flows.length)) + message.flows = []; + message.flows.push($root.google.cloud.dialogflow.cx.v3beta1.Flow.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListFlowsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse} ListFlowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListFlowsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListFlowsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListFlowsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.flows != null && message.hasOwnProperty("flows")) { + if (!Array.isArray(message.flows)) + return "flows: array expected"; + for (var i = 0; i < message.flows.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Flow.verify(message.flows[i]); + if (error) + return "flows." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListFlowsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse} ListFlowsResponse + */ + ListFlowsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse(); + if (object.flows) { + if (!Array.isArray(object.flows)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse.flows: array expected"); + message.flows = []; + for (var i = 0; i < object.flows.length; ++i) { + if (typeof object.flows[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse.flows: object expected"); + message.flows[i] = $root.google.cloud.dialogflow.cx.v3beta1.Flow.fromObject(object.flows[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListFlowsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse} message ListFlowsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListFlowsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.flows = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.flows && message.flows.length) { + object.flows = []; + for (var j = 0; j < message.flows.length; ++j) + object.flows[j] = $root.google.cloud.dialogflow.cx.v3beta1.Flow.toObject(message.flows[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListFlowsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListFlowsResponse + * @instance + * @returns {Object.} JSON object + */ + ListFlowsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListFlowsResponse; + })(); + + v3beta1.GetFlowRequest = (function() { + + /** + * Properties of a GetFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetFlowRequest + * @property {string|null} [name] GetFlowRequest name + * @property {string|null} [languageCode] GetFlowRequest languageCode + */ + + /** + * Constructs a new GetFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetFlowRequest. + * @implements IGetFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest=} [properties] Properties to set + */ + function GetFlowRequest(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]]; + } + + /** + * GetFlowRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @instance + */ + GetFlowRequest.prototype.name = ""; + + /** + * GetFlowRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @instance + */ + GetFlowRequest.prototype.languageCode = ""; + + /** + * Creates a new GetFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetFlowRequest} GetFlowRequest instance + */ + GetFlowRequest.create = function create(properties) { + return new GetFlowRequest(properties); + }; + + /** + * Encodes the specified GetFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest} message GetFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFlowRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest} message GetFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @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.GetFlowRequest} GetFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFlowRequest.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.GetFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetFlowRequest} GetFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFlowRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetFlowRequest} GetFlowRequest + */ + GetFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetFlowRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetFlowRequest} message GetFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetFlowRequest + * @instance + * @returns {Object.} JSON object + */ + GetFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetFlowRequest; + })(); + + v3beta1.UpdateFlowRequest = (function() { + + /** + * Properties of an UpdateFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateFlowRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IFlow|null} [flow] UpdateFlowRequest flow + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFlowRequest updateMask + * @property {string|null} [languageCode] UpdateFlowRequest languageCode + */ + + /** + * Constructs a new UpdateFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateFlowRequest. + * @implements IUpdateFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest=} [properties] Properties to set + */ + function UpdateFlowRequest(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]]; + } + + /** + * UpdateFlowRequest flow. + * @member {google.cloud.dialogflow.cx.v3beta1.IFlow|null|undefined} flow + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @instance + */ + UpdateFlowRequest.prototype.flow = null; + + /** + * UpdateFlowRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @instance + */ + UpdateFlowRequest.prototype.updateMask = null; + + /** + * UpdateFlowRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @instance + */ + UpdateFlowRequest.prototype.languageCode = ""; + + /** + * Creates a new UpdateFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest} UpdateFlowRequest instance + */ + UpdateFlowRequest.create = function create(properties) { + return new UpdateFlowRequest(properties); + }; + + /** + * Encodes the specified UpdateFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest} message UpdateFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFlowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.flow != null && Object.hasOwnProperty.call(message, "flow")) + $root.google.cloud.dialogflow.cx.v3beta1.Flow.encode(message.flow, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified UpdateFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest} message UpdateFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @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.UpdateFlowRequest} UpdateFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFlowRequest.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.UpdateFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.flow = $root.google.cloud.dialogflow.cx.v3beta1.Flow.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest} UpdateFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFlowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.flow != null && message.hasOwnProperty("flow")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Flow.verify(message.flow); + if (error) + return "flow." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates an UpdateFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest} UpdateFlowRequest + */ + UpdateFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest(); + if (object.flow != null) { + if (typeof object.flow !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest.flow: object expected"); + message.flow = $root.google.cloud.dialogflow.cx.v3beta1.Flow.fromObject(object.flow); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from an UpdateFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest} message UpdateFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.flow = null; + object.updateMask = null; + object.languageCode = ""; + } + if (message.flow != null && message.hasOwnProperty("flow")) + object.flow = $root.google.cloud.dialogflow.cx.v3beta1.Flow.toObject(message.flow, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this UpdateFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateFlowRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateFlowRequest; + })(); + + v3beta1.TrainFlowRequest = (function() { + + /** + * Properties of a TrainFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ITrainFlowRequest + * @property {string|null} [name] TrainFlowRequest name + */ + + /** + * Constructs a new TrainFlowRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a TrainFlowRequest. + * @implements ITrainFlowRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest=} [properties] Properties to set + */ + function TrainFlowRequest(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]]; + } + + /** + * TrainFlowRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @instance + */ + TrainFlowRequest.prototype.name = ""; + + /** + * Creates a new TrainFlowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest} TrainFlowRequest instance + */ + TrainFlowRequest.create = function create(properties) { + return new TrainFlowRequest(properties); + }; + + /** + * Encodes the specified TrainFlowRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest} message TrainFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainFlowRequest.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); + return writer; + }; + + /** + * Encodes the specified TrainFlowRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest} message TrainFlowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainFlowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TrainFlowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @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.TrainFlowRequest} TrainFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainFlowRequest.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.TrainFlowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TrainFlowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest} TrainFlowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainFlowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TrainFlowRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TrainFlowRequest.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"; + return null; + }; + + /** + * Creates a TrainFlowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest} TrainFlowRequest + */ + TrainFlowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a TrainFlowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest} message TrainFlowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TrainFlowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this TrainFlowRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.TrainFlowRequest + * @instance + * @returns {Object.} JSON object + */ + TrainFlowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TrainFlowRequest; + })(); + + v3beta1.Pages = (function() { + + /** + * Constructs a new Pages service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Pages + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Pages(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Pages.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Pages; + + /** + * Creates new Pages service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Pages} RPC service. Useful where requests and/or responses are streamed. + */ + Pages.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#listPages}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @typedef ListPagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListPagesResponse} [response] ListPagesResponse + */ + + /** + * Calls ListPages. + * @function listPages + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesRequest} request ListPagesRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Pages.ListPagesCallback} callback Node-style callback called with the error, if any, and ListPagesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Pages.prototype.listPages = function listPages(request, callback) { + return this.rpcCall(listPages, $root.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListPagesResponse, request, callback); + }, "name", { value: "ListPages" }); + + /** + * Calls ListPages. + * @function listPages + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesRequest} request ListPagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#getPage}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @typedef GetPageCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Page} [response] Page + */ + + /** + * Calls GetPage. + * @function getPage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetPageRequest} request GetPageRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Pages.GetPageCallback} callback Node-style callback called with the error, if any, and Page + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Pages.prototype.getPage = function getPage(request, callback) { + return this.rpcCall(getPage, $root.google.cloud.dialogflow.cx.v3beta1.GetPageRequest, $root.google.cloud.dialogflow.cx.v3beta1.Page, request, callback); + }, "name", { value: "GetPage" }); + + /** + * Calls GetPage. + * @function getPage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetPageRequest} request GetPageRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#createPage}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @typedef CreatePageCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Page} [response] Page + */ + + /** + * Calls CreatePage. + * @function createPage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest} request CreatePageRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Pages.CreatePageCallback} callback Node-style callback called with the error, if any, and Page + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Pages.prototype.createPage = function createPage(request, callback) { + return this.rpcCall(createPage, $root.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest, $root.google.cloud.dialogflow.cx.v3beta1.Page, request, callback); + }, "name", { value: "CreatePage" }); + + /** + * Calls CreatePage. + * @function createPage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest} request CreatePageRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#updatePage}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @typedef UpdatePageCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Page} [response] Page + */ + + /** + * Calls UpdatePage. + * @function updatePage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest} request UpdatePageRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Pages.UpdatePageCallback} callback Node-style callback called with the error, if any, and Page + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Pages.prototype.updatePage = function updatePage(request, callback) { + return this.rpcCall(updatePage, $root.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest, $root.google.cloud.dialogflow.cx.v3beta1.Page, request, callback); + }, "name", { value: "UpdatePage" }); + + /** + * Calls UpdatePage. + * @function updatePage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest} request UpdatePageRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Pages#deletePage}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @typedef DeletePageCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeletePage. + * @function deletePage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest} request DeletePageRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Pages.DeletePageCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Pages.prototype.deletePage = function deletePage(request, callback) { + return this.rpcCall(deletePage, $root.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeletePage" }); + + /** + * Calls DeletePage. + * @function deletePage + * @memberof google.cloud.dialogflow.cx.v3beta1.Pages + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest} request DeletePageRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Pages; + })(); + + v3beta1.Page = (function() { + + /** + * Properties of a Page. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IPage + * @property {string|null} [name] Page name + * @property {string|null} [displayName] Page displayName + * @property {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null} [entryFulfillment] Page entryFulfillment + * @property {google.cloud.dialogflow.cx.v3beta1.IForm|null} [form] Page form + * @property {Array.|null} [transitionRouteGroups] Page transitionRouteGroups + * @property {Array.|null} [transitionRoutes] Page transitionRoutes + * @property {Array.|null} [eventHandlers] Page eventHandlers + */ + + /** + * Constructs a new Page. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Page. + * @implements IPage + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IPage=} [properties] Properties to set + */ + function Page(properties) { + this.transitionRouteGroups = []; + this.transitionRoutes = []; + this.eventHandlers = []; + 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]]; + } + + /** + * Page name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.name = ""; + + /** + * Page displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.displayName = ""; + + /** + * Page entryFulfillment. + * @member {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null|undefined} entryFulfillment + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.entryFulfillment = null; + + /** + * Page form. + * @member {google.cloud.dialogflow.cx.v3beta1.IForm|null|undefined} form + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.form = null; + + /** + * Page transitionRouteGroups. + * @member {Array.} transitionRouteGroups + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.transitionRouteGroups = $util.emptyArray; + + /** + * Page transitionRoutes. + * @member {Array.} transitionRoutes + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.transitionRoutes = $util.emptyArray; + + /** + * Page eventHandlers. + * @member {Array.} eventHandlers + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + */ + Page.prototype.eventHandlers = $util.emptyArray; + + /** + * Creates a new Page instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IPage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Page} Page instance + */ + Page.create = function create(properties) { + return new Page(properties); + }; + + /** + * Encodes the specified Page message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Page.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.form != null && Object.hasOwnProperty.call(message, "form")) + $root.google.cloud.dialogflow.cx.v3beta1.Form.encode(message.form, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.entryFulfillment != null && Object.hasOwnProperty.call(message, "entryFulfillment")) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.encode(message.entryFulfillment, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.transitionRoutes != null && message.transitionRoutes.length) + for (var i = 0; i < message.transitionRoutes.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.encode(message.transitionRoutes[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.eventHandlers != null && message.eventHandlers.length) + for (var i = 0; i < message.eventHandlers.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.encode(message.eventHandlers[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.transitionRouteGroups != null && message.transitionRouteGroups.length) + for (var i = 0; i < message.transitionRouteGroups.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.transitionRouteGroups[i]); + return writer; + }; + + /** + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Page.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IPage} message Page message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Page.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Page message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @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.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.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.Page(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 7: + message.entryFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.decode(reader, reader.uint32()); + break; + case 4: + message.form = $root.google.cloud.dialogflow.cx.v3beta1.Form.decode(reader, reader.uint32()); + break; + case 11: + if (!(message.transitionRouteGroups && message.transitionRouteGroups.length)) + message.transitionRouteGroups = []; + message.transitionRouteGroups.push(reader.string()); + break; + case 9: + if (!(message.transitionRoutes && message.transitionRoutes.length)) + message.transitionRoutes = []; + message.transitionRoutes.push($root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.eventHandlers && message.eventHandlers.length)) + message.eventHandlers = []; + message.eventHandlers.push($root.google.cloud.dialogflow.cx.v3beta1.EventHandler.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Page message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Page} Page + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Page.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Page message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Page.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.entryFulfillment != null && message.hasOwnProperty("entryFulfillment")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify(message.entryFulfillment); + if (error) + return "entryFulfillment." + error; + } + if (message.form != null && message.hasOwnProperty("form")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Form.verify(message.form); + if (error) + return "form." + error; + } + if (message.transitionRouteGroups != null && message.hasOwnProperty("transitionRouteGroups")) { + if (!Array.isArray(message.transitionRouteGroups)) + return "transitionRouteGroups: array expected"; + for (var i = 0; i < message.transitionRouteGroups.length; ++i) + if (!$util.isString(message.transitionRouteGroups[i])) + return "transitionRouteGroups: string[] expected"; + } + if (message.transitionRoutes != null && message.hasOwnProperty("transitionRoutes")) { + if (!Array.isArray(message.transitionRoutes)) + return "transitionRoutes: array expected"; + for (var i = 0; i < message.transitionRoutes.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify(message.transitionRoutes[i]); + if (error) + return "transitionRoutes." + error; + } + } + if (message.eventHandlers != null && message.hasOwnProperty("eventHandlers")) { + if (!Array.isArray(message.eventHandlers)) + return "eventHandlers: array expected"; + for (var i = 0; i < message.eventHandlers.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.verify(message.eventHandlers[i]); + if (error) + return "eventHandlers." + error; + } + } + return null; + }; + + /** + * Creates a Page message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Page} Page + */ + Page.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Page) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Page(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.entryFulfillment != null) { + if (typeof object.entryFulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.entryFulfillment: object expected"); + message.entryFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.fromObject(object.entryFulfillment); + } + if (object.form != null) { + if (typeof object.form !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.form: object expected"); + message.form = $root.google.cloud.dialogflow.cx.v3beta1.Form.fromObject(object.form); + } + if (object.transitionRouteGroups) { + if (!Array.isArray(object.transitionRouteGroups)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.transitionRouteGroups: array expected"); + message.transitionRouteGroups = []; + for (var i = 0; i < object.transitionRouteGroups.length; ++i) + message.transitionRouteGroups[i] = String(object.transitionRouteGroups[i]); + } + if (object.transitionRoutes) { + if (!Array.isArray(object.transitionRoutes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.transitionRoutes: array expected"); + message.transitionRoutes = []; + for (var i = 0; i < object.transitionRoutes.length; ++i) { + if (typeof object.transitionRoutes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.transitionRoutes: object expected"); + message.transitionRoutes[i] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.fromObject(object.transitionRoutes[i]); + } + } + if (object.eventHandlers) { + if (!Array.isArray(object.eventHandlers)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.eventHandlers: array expected"); + message.eventHandlers = []; + for (var i = 0; i < object.eventHandlers.length; ++i) { + if (typeof object.eventHandlers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Page.eventHandlers: object expected"); + message.eventHandlers[i] = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.fromObject(object.eventHandlers[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Page message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Page} message Page + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Page.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.transitionRoutes = []; + object.eventHandlers = []; + object.transitionRouteGroups = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.form = null; + object.entryFulfillment = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.form != null && message.hasOwnProperty("form")) + object.form = $root.google.cloud.dialogflow.cx.v3beta1.Form.toObject(message.form, options); + if (message.entryFulfillment != null && message.hasOwnProperty("entryFulfillment")) + object.entryFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.toObject(message.entryFulfillment, options); + if (message.transitionRoutes && message.transitionRoutes.length) { + object.transitionRoutes = []; + for (var j = 0; j < message.transitionRoutes.length; ++j) + object.transitionRoutes[j] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.toObject(message.transitionRoutes[j], options); + } + if (message.eventHandlers && message.eventHandlers.length) { + object.eventHandlers = []; + for (var j = 0; j < message.eventHandlers.length; ++j) + object.eventHandlers[j] = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.toObject(message.eventHandlers[j], options); + } + if (message.transitionRouteGroups && message.transitionRouteGroups.length) { + object.transitionRouteGroups = []; + for (var j = 0; j < message.transitionRouteGroups.length; ++j) + object.transitionRouteGroups[j] = message.transitionRouteGroups[j]; + } + return object; + }; + + /** + * Converts this Page to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Page + * @instance + * @returns {Object.} JSON object + */ + Page.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Page; + })(); + + v3beta1.Form = (function() { + + /** + * Properties of a Form. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IForm + * @property {Array.|null} [parameters] Form parameters + */ + + /** + * Constructs a new Form. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Form. + * @implements IForm + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IForm=} [properties] Properties to set + */ + function Form(properties) { + this.parameters = []; + 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]]; + } + + /** + * Form parameters. + * @member {Array.} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @instance + */ + Form.prototype.parameters = $util.emptyArray; + + /** + * Creates a new Form instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IForm=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Form} Form instance + */ + Form.create = function create(properties) { + return new Form(properties); + }; + + /** + * Encodes the specified Form message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IForm} message Form message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Form.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parameters != null && message.parameters.length) + for (var i = 0; i < message.parameters.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.encode(message.parameters[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Form message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IForm} message Form message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Form.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Form message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @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.Form} Form + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Form.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.Form(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.parameters && message.parameters.length)) + message.parameters = []; + message.parameters.push($root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Form message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Form} Form + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Form.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Form message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Form.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (!Array.isArray(message.parameters)) + return "parameters: array expected"; + for (var i = 0; i < message.parameters.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.verify(message.parameters[i]); + if (error) + return "parameters." + error; + } + } + return null; + }; + + /** + * Creates a Form message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Form} Form + */ + Form.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Form) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Form(); + if (object.parameters) { + if (!Array.isArray(object.parameters)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.parameters: array expected"); + message.parameters = []; + for (var i = 0; i < object.parameters.length; ++i) { + if (typeof object.parameters[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.parameters: object expected"); + message.parameters[i] = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.fromObject(object.parameters[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Form message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form} message Form + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Form.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parameters = []; + if (message.parameters && message.parameters.length) { + object.parameters = []; + for (var j = 0; j < message.parameters.length; ++j) + object.parameters[j] = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.toObject(message.parameters[j], options); + } + return object; + }; + + /** + * Converts this Form to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @instance + * @returns {Object.} JSON object + */ + Form.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Form.Parameter = (function() { + + /** + * Properties of a Parameter. + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @interface IParameter + * @property {string|null} [displayName] Parameter displayName + * @property {boolean|null} [required] Parameter required + * @property {string|null} [entityType] Parameter entityType + * @property {boolean|null} [isList] Parameter isList + * @property {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior|null} [fillBehavior] Parameter fillBehavior + * @property {google.protobuf.IValue|null} [defaultValue] Parameter defaultValue + * @property {boolean|null} [redact] Parameter redact + */ + + /** + * Constructs a new Parameter. + * @memberof google.cloud.dialogflow.cx.v3beta1.Form + * @classdesc Represents a Parameter. + * @implements IParameter + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Form.IParameter=} [properties] Properties to set + */ + function Parameter(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]]; + } + + /** + * Parameter displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.displayName = ""; + + /** + * Parameter required. + * @member {boolean} required + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.required = false; + + /** + * Parameter entityType. + * @member {string} entityType + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.entityType = ""; + + /** + * Parameter isList. + * @member {boolean} isList + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.isList = false; + + /** + * Parameter fillBehavior. + * @member {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior|null|undefined} fillBehavior + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.fillBehavior = null; + + /** + * Parameter defaultValue. + * @member {google.protobuf.IValue|null|undefined} defaultValue + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.defaultValue = null; + + /** + * Parameter redact. + * @member {boolean} redact + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + */ + Parameter.prototype.redact = false; + + /** + * Creates a new Parameter instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.IParameter=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Form.Parameter} Parameter instance + */ + Parameter.create = function create(properties) { + return new Parameter(properties); + }; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.required != null && Object.hasOwnProperty.call(message, "required")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.required); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entityType); + if (message.isList != null && Object.hasOwnProperty.call(message, "isList")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isList); + if (message.fillBehavior != null && Object.hasOwnProperty.call(message, "fillBehavior")) + $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.encode(message.fillBehavior, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + $root.google.protobuf.Value.encode(message.defaultValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.redact != null && Object.hasOwnProperty.call(message, "redact")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.redact); + return writer; + }; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @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.Form.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.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.Form.Parameter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + message.required = reader.bool(); + break; + case 3: + message.entityType = reader.string(); + break; + case 4: + message.isList = reader.bool(); + break; + case 7: + message.fillBehavior = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.decode(reader, reader.uint32()); + break; + case 9: + message.defaultValue = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + case 11: + message.redact = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Form.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Parameter message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Parameter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.required != null && message.hasOwnProperty("required")) + if (typeof message.required !== "boolean") + return "required: boolean expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) + if (!$util.isString(message.entityType)) + return "entityType: string expected"; + if (message.isList != null && message.hasOwnProperty("isList")) + if (typeof message.isList !== "boolean") + return "isList: boolean expected"; + if (message.fillBehavior != null && message.hasOwnProperty("fillBehavior")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.verify(message.fillBehavior); + if (error) + return "fillBehavior." + error; + } + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) { + var error = $root.google.protobuf.Value.verify(message.defaultValue); + if (error) + return "defaultValue." + error; + } + if (message.redact != null && message.hasOwnProperty("redact")) + if (typeof message.redact !== "boolean") + return "redact: boolean expected"; + return null; + }; + + /** + * Creates a Parameter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Form.Parameter} Parameter + */ + Parameter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.required != null) + message.required = Boolean(object.required); + if (object.entityType != null) + message.entityType = String(object.entityType); + if (object.isList != null) + message.isList = Boolean(object.isList); + if (object.fillBehavior != null) { + if (typeof object.fillBehavior !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.Parameter.fillBehavior: object expected"); + message.fillBehavior = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.fromObject(object.fillBehavior); + } + if (object.defaultValue != null) { + if (typeof object.defaultValue !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.Parameter.defaultValue: object expected"); + message.defaultValue = $root.google.protobuf.Value.fromObject(object.defaultValue); + } + if (object.redact != null) + message.redact = Boolean(object.redact); + return message; + }; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.Parameter} message Parameter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Parameter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayName = ""; + object.required = false; + object.entityType = ""; + object.isList = false; + object.fillBehavior = null; + object.defaultValue = null; + object.redact = false; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.required != null && message.hasOwnProperty("required")) + object.required = message.required; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = message.entityType; + if (message.isList != null && message.hasOwnProperty("isList")) + object.isList = message.isList; + if (message.fillBehavior != null && message.hasOwnProperty("fillBehavior")) + object.fillBehavior = $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.toObject(message.fillBehavior, options); + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = $root.google.protobuf.Value.toObject(message.defaultValue, options); + if (message.redact != null && message.hasOwnProperty("redact")) + object.redact = message.redact; + return object; + }; + + /** + * Converts this Parameter to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @instance + * @returns {Object.} JSON object + */ + Parameter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Parameter.FillBehavior = (function() { + + /** + * Properties of a FillBehavior. + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @interface IFillBehavior + * @property {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null} [initialPromptFulfillment] FillBehavior initialPromptFulfillment + * @property {Array.|null} [repromptEventHandlers] FillBehavior repromptEventHandlers + */ + + /** + * Constructs a new FillBehavior. + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter + * @classdesc Represents a FillBehavior. + * @implements IFillBehavior + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior=} [properties] Properties to set + */ + function FillBehavior(properties) { + this.repromptEventHandlers = []; + 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]]; + } + + /** + * FillBehavior initialPromptFulfillment. + * @member {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null|undefined} initialPromptFulfillment + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @instance + */ + FillBehavior.prototype.initialPromptFulfillment = null; + + /** + * FillBehavior repromptEventHandlers. + * @member {Array.} repromptEventHandlers + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @instance + */ + FillBehavior.prototype.repromptEventHandlers = $util.emptyArray; + + /** + * Creates a new FillBehavior instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior} FillBehavior instance + */ + FillBehavior.create = function create(properties) { + return new FillBehavior(properties); + }; + + /** + * Encodes the specified FillBehavior message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior} message FillBehavior message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FillBehavior.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initialPromptFulfillment != null && Object.hasOwnProperty.call(message, "initialPromptFulfillment")) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.encode(message.initialPromptFulfillment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.repromptEventHandlers != null && message.repromptEventHandlers.length) + for (var i = 0; i < message.repromptEventHandlers.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.encode(message.repromptEventHandlers[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FillBehavior message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.IFillBehavior} message FillBehavior message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FillBehavior.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FillBehavior message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @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.Form.Parameter.FillBehavior} FillBehavior + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FillBehavior.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.Form.Parameter.FillBehavior(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.initialPromptFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.decode(reader, reader.uint32()); + break; + case 5: + if (!(message.repromptEventHandlers && message.repromptEventHandlers.length)) + message.repromptEventHandlers = []; + message.repromptEventHandlers.push($root.google.cloud.dialogflow.cx.v3beta1.EventHandler.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FillBehavior message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior} FillBehavior + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FillBehavior.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FillBehavior message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FillBehavior.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initialPromptFulfillment != null && message.hasOwnProperty("initialPromptFulfillment")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify(message.initialPromptFulfillment); + if (error) + return "initialPromptFulfillment." + error; + } + if (message.repromptEventHandlers != null && message.hasOwnProperty("repromptEventHandlers")) { + if (!Array.isArray(message.repromptEventHandlers)) + return "repromptEventHandlers: array expected"; + for (var i = 0; i < message.repromptEventHandlers.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.verify(message.repromptEventHandlers[i]); + if (error) + return "repromptEventHandlers." + error; + } + } + return null; + }; + + /** + * Creates a FillBehavior message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior} FillBehavior + */ + FillBehavior.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior(); + if (object.initialPromptFulfillment != null) { + if (typeof object.initialPromptFulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.initialPromptFulfillment: object expected"); + message.initialPromptFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.fromObject(object.initialPromptFulfillment); + } + if (object.repromptEventHandlers) { + if (!Array.isArray(object.repromptEventHandlers)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.repromptEventHandlers: array expected"); + message.repromptEventHandlers = []; + for (var i = 0; i < object.repromptEventHandlers.length; ++i) { + if (typeof object.repromptEventHandlers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior.repromptEventHandlers: object expected"); + message.repromptEventHandlers[i] = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.fromObject(object.repromptEventHandlers[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FillBehavior message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior} message FillBehavior + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FillBehavior.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.repromptEventHandlers = []; + if (options.defaults) + object.initialPromptFulfillment = null; + if (message.initialPromptFulfillment != null && message.hasOwnProperty("initialPromptFulfillment")) + object.initialPromptFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.toObject(message.initialPromptFulfillment, options); + if (message.repromptEventHandlers && message.repromptEventHandlers.length) { + object.repromptEventHandlers = []; + for (var j = 0; j < message.repromptEventHandlers.length; ++j) + object.repromptEventHandlers[j] = $root.google.cloud.dialogflow.cx.v3beta1.EventHandler.toObject(message.repromptEventHandlers[j], options); + } + return object; + }; + + /** + * Converts this FillBehavior to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Form.Parameter.FillBehavior + * @instance + * @returns {Object.} JSON object + */ + FillBehavior.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FillBehavior; + })(); + + return Parameter; + })(); + + return Form; + })(); + + v3beta1.EventHandler = (function() { + + /** + * Properties of an EventHandler. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IEventHandler + * @property {string|null} [name] EventHandler name + * @property {string|null} [event] EventHandler event + * @property {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null} [triggerFulfillment] EventHandler triggerFulfillment + * @property {string|null} [targetPage] EventHandler targetPage + * @property {string|null} [targetFlow] EventHandler targetFlow + */ + + /** + * Constructs a new EventHandler. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an EventHandler. + * @implements IEventHandler + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IEventHandler=} [properties] Properties to set + */ + function EventHandler(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]]; + } + + /** + * EventHandler name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + */ + EventHandler.prototype.name = ""; + + /** + * EventHandler event. + * @member {string} event + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + */ + EventHandler.prototype.event = ""; + + /** + * EventHandler triggerFulfillment. + * @member {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null|undefined} triggerFulfillment + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + */ + EventHandler.prototype.triggerFulfillment = null; + + /** + * EventHandler targetPage. + * @member {string} targetPage + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + */ + EventHandler.prototype.targetPage = ""; + + /** + * EventHandler targetFlow. + * @member {string} targetFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + */ + EventHandler.prototype.targetFlow = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EventHandler target. + * @member {"targetPage"|"targetFlow"|undefined} target + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + */ + Object.defineProperty(EventHandler.prototype, "target", { + get: $util.oneOfGetter($oneOfFields = ["targetPage", "targetFlow"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EventHandler instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEventHandler=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.EventHandler} EventHandler instance + */ + EventHandler.create = function create(properties) { + return new EventHandler(properties); + }; + + /** + * Encodes the specified EventHandler message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventHandler.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEventHandler} message EventHandler message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventHandler.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetPage != null && Object.hasOwnProperty.call(message, "targetPage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetPage); + if (message.targetFlow != null && Object.hasOwnProperty.call(message, "targetFlow")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetFlow); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.event); + if (message.triggerFulfillment != null && Object.hasOwnProperty.call(message, "triggerFulfillment")) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.encode(message.triggerFulfillment, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.name); + return writer; + }; + + /** + * Encodes the specified EventHandler message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventHandler.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEventHandler} message EventHandler message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventHandler.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventHandler message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @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.EventHandler} EventHandler + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventHandler.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.EventHandler(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.name = reader.string(); + break; + case 4: + message.event = reader.string(); + break; + case 5: + message.triggerFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.decode(reader, reader.uint32()); + break; + case 2: + message.targetPage = reader.string(); + break; + case 3: + message.targetFlow = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventHandler message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.EventHandler} EventHandler + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventHandler.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventHandler message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventHandler.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.event != null && message.hasOwnProperty("event")) + if (!$util.isString(message.event)) + return "event: string expected"; + if (message.triggerFulfillment != null && message.hasOwnProperty("triggerFulfillment")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify(message.triggerFulfillment); + if (error) + return "triggerFulfillment." + error; + } + if (message.targetPage != null && message.hasOwnProperty("targetPage")) { + properties.target = 1; + if (!$util.isString(message.targetPage)) + return "targetPage: string expected"; + } + if (message.targetFlow != null && message.hasOwnProperty("targetFlow")) { + if (properties.target === 1) + return "target: multiple values"; + properties.target = 1; + if (!$util.isString(message.targetFlow)) + return "targetFlow: string expected"; + } + return null; + }; + + /** + * Creates an EventHandler message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.EventHandler} EventHandler + */ + EventHandler.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.EventHandler) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.EventHandler(); + if (object.name != null) + message.name = String(object.name); + if (object.event != null) + message.event = String(object.event); + if (object.triggerFulfillment != null) { + if (typeof object.triggerFulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.EventHandler.triggerFulfillment: object expected"); + message.triggerFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.fromObject(object.triggerFulfillment); + } + if (object.targetPage != null) + message.targetPage = String(object.targetPage); + if (object.targetFlow != null) + message.targetFlow = String(object.targetFlow); + return message; + }; + + /** + * Creates a plain object from an EventHandler message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EventHandler} message EventHandler + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventHandler.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.event = ""; + object.triggerFulfillment = null; + object.name = ""; + } + if (message.targetPage != null && message.hasOwnProperty("targetPage")) { + object.targetPage = message.targetPage; + if (options.oneofs) + object.target = "targetPage"; + } + if (message.targetFlow != null && message.hasOwnProperty("targetFlow")) { + object.targetFlow = message.targetFlow; + if (options.oneofs) + object.target = "targetFlow"; + } + if (message.event != null && message.hasOwnProperty("event")) + object.event = message.event; + if (message.triggerFulfillment != null && message.hasOwnProperty("triggerFulfillment")) + object.triggerFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.toObject(message.triggerFulfillment, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this EventHandler to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.EventHandler + * @instance + * @returns {Object.} JSON object + */ + EventHandler.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventHandler; + })(); + + v3beta1.TransitionRoute = (function() { + + /** + * Properties of a TransitionRoute. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ITransitionRoute + * @property {string|null} [name] TransitionRoute name + * @property {string|null} [intent] TransitionRoute intent + * @property {string|null} [condition] TransitionRoute condition + * @property {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null} [triggerFulfillment] TransitionRoute triggerFulfillment + * @property {string|null} [targetPage] TransitionRoute targetPage + * @property {string|null} [targetFlow] TransitionRoute targetFlow + */ + + /** + * Constructs a new TransitionRoute. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a TransitionRoute. + * @implements ITransitionRoute + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRoute=} [properties] Properties to set + */ + function TransitionRoute(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]]; + } + + /** + * TransitionRoute name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + TransitionRoute.prototype.name = ""; + + /** + * TransitionRoute intent. + * @member {string} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + TransitionRoute.prototype.intent = ""; + + /** + * TransitionRoute condition. + * @member {string} condition + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + TransitionRoute.prototype.condition = ""; + + /** + * TransitionRoute triggerFulfillment. + * @member {google.cloud.dialogflow.cx.v3beta1.IFulfillment|null|undefined} triggerFulfillment + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + TransitionRoute.prototype.triggerFulfillment = null; + + /** + * TransitionRoute targetPage. + * @member {string} targetPage + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + TransitionRoute.prototype.targetPage = ""; + + /** + * TransitionRoute targetFlow. + * @member {string} targetFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + TransitionRoute.prototype.targetFlow = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TransitionRoute target. + * @member {"targetPage"|"targetFlow"|undefined} target + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + */ + Object.defineProperty(TransitionRoute.prototype, "target", { + get: $util.oneOfGetter($oneOfFields = ["targetPage", "targetFlow"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TransitionRoute instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRoute=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.TransitionRoute} TransitionRoute instance + */ + TransitionRoute.create = function create(properties) { + return new TransitionRoute(properties); + }; + + /** + * Encodes the specified TransitionRoute message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRoute} message TransitionRoute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransitionRoute.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.intent); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.condition); + if (message.triggerFulfillment != null && Object.hasOwnProperty.call(message, "triggerFulfillment")) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.encode(message.triggerFulfillment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.targetPage != null && Object.hasOwnProperty.call(message, "targetPage")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.targetPage); + if (message.targetFlow != null && Object.hasOwnProperty.call(message, "targetFlow")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.targetFlow); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.name); + return writer; + }; + + /** + * Encodes the specified TransitionRoute message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRoute} message TransitionRoute message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransitionRoute.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransitionRoute message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @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.TransitionRoute} TransitionRoute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransitionRoute.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.TransitionRoute(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.name = reader.string(); + break; + case 1: + message.intent = reader.string(); + break; + case 2: + message.condition = reader.string(); + break; + case 3: + message.triggerFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.decode(reader, reader.uint32()); + break; + case 4: + message.targetPage = reader.string(); + break; + case 5: + message.targetFlow = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransitionRoute message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.TransitionRoute} TransitionRoute + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransitionRoute.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransitionRoute message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransitionRoute.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.intent != null && message.hasOwnProperty("intent")) + if (!$util.isString(message.intent)) + return "intent: string expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.triggerFulfillment != null && message.hasOwnProperty("triggerFulfillment")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify(message.triggerFulfillment); + if (error) + return "triggerFulfillment." + error; + } + if (message.targetPage != null && message.hasOwnProperty("targetPage")) { + properties.target = 1; + if (!$util.isString(message.targetPage)) + return "targetPage: string expected"; + } + if (message.targetFlow != null && message.hasOwnProperty("targetFlow")) { + if (properties.target === 1) + return "target: multiple values"; + properties.target = 1; + if (!$util.isString(message.targetFlow)) + return "targetFlow: string expected"; + } + return null; + }; + + /** + * Creates a TransitionRoute message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.TransitionRoute} TransitionRoute + */ + TransitionRoute.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute(); + if (object.name != null) + message.name = String(object.name); + if (object.intent != null) + message.intent = String(object.intent); + if (object.condition != null) + message.condition = String(object.condition); + if (object.triggerFulfillment != null) { + if (typeof object.triggerFulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.TransitionRoute.triggerFulfillment: object expected"); + message.triggerFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.fromObject(object.triggerFulfillment); + } + if (object.targetPage != null) + message.targetPage = String(object.targetPage); + if (object.targetFlow != null) + message.targetFlow = String(object.targetFlow); + return message; + }; + + /** + * Creates a plain object from a TransitionRoute message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRoute} message TransitionRoute + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransitionRoute.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.intent = ""; + object.condition = ""; + object.triggerFulfillment = null; + object.name = ""; + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = message.intent; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.triggerFulfillment != null && message.hasOwnProperty("triggerFulfillment")) + object.triggerFulfillment = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.toObject(message.triggerFulfillment, options); + if (message.targetPage != null && message.hasOwnProperty("targetPage")) { + object.targetPage = message.targetPage; + if (options.oneofs) + object.target = "targetPage"; + } + if (message.targetFlow != null && message.hasOwnProperty("targetFlow")) { + object.targetFlow = message.targetFlow; + if (options.oneofs) + object.target = "targetFlow"; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this TransitionRoute to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRoute + * @instance + * @returns {Object.} JSON object + */ + TransitionRoute.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TransitionRoute; + })(); + + v3beta1.ListPagesRequest = (function() { + + /** + * Properties of a ListPagesRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListPagesRequest + * @property {string|null} [parent] ListPagesRequest parent + * @property {string|null} [languageCode] ListPagesRequest languageCode + * @property {number|null} [pageSize] ListPagesRequest pageSize + * @property {string|null} [pageToken] ListPagesRequest pageToken + */ + + /** + * Constructs a new ListPagesRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListPagesRequest. + * @implements IListPagesRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesRequest=} [properties] Properties to set + */ + function ListPagesRequest(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]]; + } + + /** + * ListPagesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @instance + */ + ListPagesRequest.prototype.parent = ""; + + /** + * ListPagesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @instance + */ + ListPagesRequest.prototype.languageCode = ""; + + /** + * ListPagesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @instance + */ + ListPagesRequest.prototype.pageSize = 0; + + /** + * ListPagesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @instance + */ + ListPagesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListPagesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListPagesRequest} ListPagesRequest instance + */ + ListPagesRequest.create = function create(properties) { + return new ListPagesRequest(properties); + }; + + /** + * Encodes the specified ListPagesRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesRequest} message ListPagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListPagesRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListPagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesRequest} message ListPagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListPagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListPagesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @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.ListPagesRequest} ListPagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListPagesRequest.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.ListPagesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListPagesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListPagesRequest} ListPagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListPagesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListPagesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListPagesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListPagesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListPagesRequest} ListPagesRequest + */ + ListPagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListPagesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListPagesRequest} message ListPagesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListPagesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListPagesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesRequest + * @instance + * @returns {Object.} JSON object + */ + ListPagesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListPagesRequest; + })(); + + v3beta1.ListPagesResponse = (function() { + + /** + * Properties of a ListPagesResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListPagesResponse + * @property {Array.|null} [pages] ListPagesResponse pages + * @property {string|null} [nextPageToken] ListPagesResponse nextPageToken + */ + + /** + * Constructs a new ListPagesResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListPagesResponse. + * @implements IListPagesResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesResponse=} [properties] Properties to set + */ + function ListPagesResponse(properties) { + this.pages = []; + 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]]; + } + + /** + * ListPagesResponse pages. + * @member {Array.} pages + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @instance + */ + ListPagesResponse.prototype.pages = $util.emptyArray; + + /** + * ListPagesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @instance + */ + ListPagesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListPagesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListPagesResponse} ListPagesResponse instance + */ + ListPagesResponse.create = function create(properties) { + return new ListPagesResponse(properties); + }; + + /** + * Encodes the specified ListPagesResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesResponse} message ListPagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListPagesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListPagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListPagesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListPagesResponse} message ListPagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListPagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListPagesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @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.ListPagesResponse} ListPagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListPagesResponse.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.ListPagesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.dialogflow.cx.v3beta1.Page.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListPagesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListPagesResponse} ListPagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListPagesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListPagesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListPagesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Page.verify(message.pages[i]); + if (error) + return "pages." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListPagesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListPagesResponse} ListPagesResponse + */ + ListPagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListPagesResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListPagesResponse(); + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListPagesResponse.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListPagesResponse.pages: object expected"); + message.pages[i] = $root.google.cloud.dialogflow.cx.v3beta1.Page.fromObject(object.pages[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListPagesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListPagesResponse} message ListPagesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListPagesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pages = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.dialogflow.cx.v3beta1.Page.toObject(message.pages[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListPagesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListPagesResponse + * @instance + * @returns {Object.} JSON object + */ + ListPagesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListPagesResponse; + })(); + + v3beta1.GetPageRequest = (function() { + + /** + * Properties of a GetPageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetPageRequest + * @property {string|null} [name] GetPageRequest name + * @property {string|null} [languageCode] GetPageRequest languageCode + */ + + /** + * Constructs a new GetPageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetPageRequest. + * @implements IGetPageRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetPageRequest=} [properties] Properties to set + */ + function GetPageRequest(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]]; + } + + /** + * GetPageRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @instance + */ + GetPageRequest.prototype.name = ""; + + /** + * GetPageRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @instance + */ + GetPageRequest.prototype.languageCode = ""; + + /** + * Creates a new GetPageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetPageRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetPageRequest} GetPageRequest instance + */ + GetPageRequest.create = function create(properties) { + return new GetPageRequest(properties); + }; + + /** + * Encodes the specified GetPageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetPageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetPageRequest} message GetPageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPageRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetPageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetPageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetPageRequest} message GetPageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetPageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @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.GetPageRequest} GetPageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPageRequest.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.GetPageRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetPageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetPageRequest} GetPageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetPageRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetPageRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetPageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetPageRequest} GetPageRequest + */ + GetPageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetPageRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetPageRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetPageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetPageRequest} message GetPageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetPageRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetPageRequest + * @instance + * @returns {Object.} JSON object + */ + GetPageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetPageRequest; + })(); + + v3beta1.CreatePageRequest = (function() { + + /** + * Properties of a CreatePageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreatePageRequest + * @property {string|null} [parent] CreatePageRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IPage|null} [page] CreatePageRequest page + * @property {string|null} [languageCode] CreatePageRequest languageCode + */ + + /** + * Constructs a new CreatePageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreatePageRequest. + * @implements ICreatePageRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest=} [properties] Properties to set + */ + function CreatePageRequest(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]]; + } + + /** + * CreatePageRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @instance + */ + CreatePageRequest.prototype.parent = ""; + + /** + * CreatePageRequest page. + * @member {google.cloud.dialogflow.cx.v3beta1.IPage|null|undefined} page + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @instance + */ + CreatePageRequest.prototype.page = null; + + /** + * CreatePageRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @instance + */ + CreatePageRequest.prototype.languageCode = ""; + + /** + * Creates a new CreatePageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreatePageRequest} CreatePageRequest instance + */ + CreatePageRequest.create = function create(properties) { + return new CreatePageRequest(properties); + }; + + /** + * Encodes the specified CreatePageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreatePageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest} message CreatePageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatePageRequest.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.page != null && Object.hasOwnProperty.call(message, "page")) + $root.google.cloud.dialogflow.cx.v3beta1.Page.encode(message.page, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreatePageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreatePageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest} message CreatePageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreatePageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreatePageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @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.CreatePageRequest} CreatePageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatePageRequest.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.CreatePageRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.page = $root.google.cloud.dialogflow.cx.v3beta1.Page.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreatePageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreatePageRequest} CreatePageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreatePageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreatePageRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreatePageRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.page != null && message.hasOwnProperty("page")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Page.verify(message.page); + if (error) + return "page." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreatePageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreatePageRequest} CreatePageRequest + */ + CreatePageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.page != null) { + if (typeof object.page !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreatePageRequest.page: object expected"); + message.page = $root.google.cloud.dialogflow.cx.v3beta1.Page.fromObject(object.page); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreatePageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreatePageRequest} message CreatePageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreatePageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.page = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.page != null && message.hasOwnProperty("page")) + object.page = $root.google.cloud.dialogflow.cx.v3beta1.Page.toObject(message.page, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreatePageRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreatePageRequest + * @instance + * @returns {Object.} JSON object + */ + CreatePageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreatePageRequest; + })(); + + v3beta1.UpdatePageRequest = (function() { + + /** + * Properties of an UpdatePageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdatePageRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IPage|null} [page] UpdatePageRequest page + * @property {string|null} [languageCode] UpdatePageRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdatePageRequest updateMask + */ + + /** + * Constructs a new UpdatePageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdatePageRequest. + * @implements IUpdatePageRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest=} [properties] Properties to set + */ + function UpdatePageRequest(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]]; + } + + /** + * UpdatePageRequest page. + * @member {google.cloud.dialogflow.cx.v3beta1.IPage|null|undefined} page + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @instance + */ + UpdatePageRequest.prototype.page = null; + + /** + * UpdatePageRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @instance + */ + UpdatePageRequest.prototype.languageCode = ""; + + /** + * UpdatePageRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @instance + */ + UpdatePageRequest.prototype.updateMask = null; + + /** + * Creates a new UpdatePageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest} UpdatePageRequest instance + */ + UpdatePageRequest.create = function create(properties) { + return new UpdatePageRequest(properties); + }; + + /** + * Encodes the specified UpdatePageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest} message UpdatePageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdatePageRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.page != null && Object.hasOwnProperty.call(message, "page")) + $root.google.cloud.dialogflow.cx.v3beta1.Page.encode(message.page, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdatePageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest} message UpdatePageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdatePageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdatePageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @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.UpdatePageRequest} UpdatePageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdatePageRequest.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.UpdatePageRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.page = $root.google.cloud.dialogflow.cx.v3beta1.Page.decode(reader, reader.uint32()); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdatePageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest} UpdatePageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdatePageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdatePageRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdatePageRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.page != null && message.hasOwnProperty("page")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Page.verify(message.page); + if (error) + return "page." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdatePageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest} UpdatePageRequest + */ + UpdatePageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest(); + if (object.page != null) { + if (typeof object.page !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest.page: object expected"); + message.page = $root.google.cloud.dialogflow.cx.v3beta1.Page.fromObject(object.page); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdatePageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest} message UpdatePageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdatePageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.page = null; + object.languageCode = ""; + object.updateMask = null; + } + if (message.page != null && message.hasOwnProperty("page")) + object.page = $root.google.cloud.dialogflow.cx.v3beta1.Page.toObject(message.page, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdatePageRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest + * @instance + * @returns {Object.} JSON object + */ + UpdatePageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdatePageRequest; + })(); + + v3beta1.DeletePageRequest = (function() { + + /** + * Properties of a DeletePageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeletePageRequest + * @property {string|null} [name] DeletePageRequest name + * @property {boolean|null} [force] DeletePageRequest force + */ + + /** + * Constructs a new DeletePageRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeletePageRequest. + * @implements IDeletePageRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest=} [properties] Properties to set + */ + function DeletePageRequest(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]]; + } + + /** + * DeletePageRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @instance + */ + DeletePageRequest.prototype.name = ""; + + /** + * DeletePageRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @instance + */ + DeletePageRequest.prototype.force = false; + + /** + * Creates a new DeletePageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeletePageRequest} DeletePageRequest instance + */ + DeletePageRequest.create = function create(properties) { + return new DeletePageRequest(properties); + }; + + /** + * Encodes the specified DeletePageRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeletePageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest} message DeletePageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePageRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeletePageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeletePageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest} message DeletePageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeletePageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeletePageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @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.DeletePageRequest} DeletePageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePageRequest.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.DeletePageRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeletePageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeletePageRequest} DeletePageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeletePageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeletePageRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeletePageRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeletePageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeletePageRequest} DeletePageRequest + */ + DeletePageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeletePageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeletePageRequest} message DeletePageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeletePageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeletePageRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeletePageRequest + * @instance + * @returns {Object.} JSON object + */ + DeletePageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeletePageRequest; + })(); + + v3beta1.Fulfillment = (function() { + + /** + * Properties of a Fulfillment. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IFulfillment + * @property {Array.|null} [messages] Fulfillment messages + * @property {string|null} [webhook] Fulfillment webhook + * @property {string|null} [tag] Fulfillment tag + * @property {Array.|null} [setParameterActions] Fulfillment setParameterActions + * @property {Array.|null} [conditionalCases] Fulfillment conditionalCases + */ + + /** + * Constructs a new Fulfillment. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Fulfillment. + * @implements IFulfillment + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillment=} [properties] Properties to set + */ + function Fulfillment(properties) { + this.messages = []; + this.setParameterActions = []; + this.conditionalCases = []; + 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]]; + } + + /** + * Fulfillment messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.messages = $util.emptyArray; + + /** + * Fulfillment webhook. + * @member {string} webhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.webhook = ""; + + /** + * Fulfillment tag. + * @member {string} tag + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.tag = ""; + + /** + * Fulfillment setParameterActions. + * @member {Array.} setParameterActions + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.setParameterActions = $util.emptyArray; + + /** + * Fulfillment conditionalCases. + * @member {Array.} conditionalCases + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.conditionalCases = $util.emptyArray; + + /** + * Creates a new Fulfillment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment} Fulfillment instance + */ + Fulfillment.create = function create(properties) { + return new Fulfillment(properties); + }; + + /** + * Encodes the specified Fulfillment message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillment} message Fulfillment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fulfillment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.encode(message.messages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.webhook != null && Object.hasOwnProperty.call(message, "webhook")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.webhook); + if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.tag); + if (message.setParameterActions != null && message.setParameterActions.length) + for (var i = 0; i < message.setParameterActions.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.encode(message.setParameterActions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.conditionalCases != null && message.conditionalCases.length) + for (var i = 0; i < message.conditionalCases.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.encode(message.conditionalCases[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Fulfillment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillment} message Fulfillment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fulfillment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Fulfillment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @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.Fulfillment} Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fulfillment.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.Fulfillment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.decode(reader, reader.uint32())); + break; + case 2: + message.webhook = reader.string(); + break; + case 3: + message.tag = reader.string(); + break; + case 4: + if (!(message.setParameterActions && message.setParameterActions.length)) + message.setParameterActions = []; + message.setParameterActions.push($root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.conditionalCases && message.conditionalCases.length)) + message.conditionalCases = []; + message.conditionalCases.push($root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Fulfillment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment} Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fulfillment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Fulfillment message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Fulfillment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.webhook != null && message.hasOwnProperty("webhook")) + if (!$util.isString(message.webhook)) + return "webhook: string expected"; + if (message.tag != null && message.hasOwnProperty("tag")) + if (!$util.isString(message.tag)) + return "tag: string expected"; + if (message.setParameterActions != null && message.hasOwnProperty("setParameterActions")) { + if (!Array.isArray(message.setParameterActions)) + return "setParameterActions: array expected"; + for (var i = 0; i < message.setParameterActions.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.verify(message.setParameterActions[i]); + if (error) + return "setParameterActions." + error; + } + } + if (message.conditionalCases != null && message.hasOwnProperty("conditionalCases")) { + if (!Array.isArray(message.conditionalCases)) + return "conditionalCases: array expected"; + for (var i = 0; i < message.conditionalCases.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.verify(message.conditionalCases[i]); + if (error) + return "conditionalCases." + error; + } + } + return null; + }; + + /** + * Creates a Fulfillment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment} Fulfillment + */ + Fulfillment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.fromObject(object.messages[i]); + } + } + if (object.webhook != null) + message.webhook = String(object.webhook); + if (object.tag != null) + message.tag = String(object.tag); + if (object.setParameterActions) { + if (!Array.isArray(object.setParameterActions)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.setParameterActions: array expected"); + message.setParameterActions = []; + for (var i = 0; i < object.setParameterActions.length; ++i) { + if (typeof object.setParameterActions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.setParameterActions: object expected"); + message.setParameterActions[i] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.fromObject(object.setParameterActions[i]); + } + } + if (object.conditionalCases) { + if (!Array.isArray(object.conditionalCases)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.conditionalCases: array expected"); + message.conditionalCases = []; + for (var i = 0; i < object.conditionalCases.length; ++i) { + if (typeof object.conditionalCases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.conditionalCases: object expected"); + message.conditionalCases[i] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.fromObject(object.conditionalCases[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Fulfillment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment} message Fulfillment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Fulfillment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.messages = []; + object.setParameterActions = []; + object.conditionalCases = []; + } + if (options.defaults) { + object.webhook = ""; + object.tag = ""; + } + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.toObject(message.messages[j], options); + } + if (message.webhook != null && message.hasOwnProperty("webhook")) + object.webhook = message.webhook; + if (message.tag != null && message.hasOwnProperty("tag")) + object.tag = message.tag; + if (message.setParameterActions && message.setParameterActions.length) { + object.setParameterActions = []; + for (var j = 0; j < message.setParameterActions.length; ++j) + object.setParameterActions[j] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.toObject(message.setParameterActions[j], options); + } + if (message.conditionalCases && message.conditionalCases.length) { + object.conditionalCases = []; + for (var j = 0; j < message.conditionalCases.length; ++j) + object.conditionalCases[j] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.toObject(message.conditionalCases[j], options); + } + return object; + }; + + /** + * Converts this Fulfillment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @instance + * @returns {Object.} JSON object + */ + Fulfillment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Fulfillment.SetParameterAction = (function() { + + /** + * Properties of a SetParameterAction. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @interface ISetParameterAction + * @property {string|null} [parameter] SetParameterAction parameter + * @property {google.protobuf.IValue|null} [value] SetParameterAction value + */ + + /** + * Constructs a new SetParameterAction. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @classdesc Represents a SetParameterAction. + * @implements ISetParameterAction + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction=} [properties] Properties to set + */ + function SetParameterAction(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]]; + } + + /** + * SetParameterAction parameter. + * @member {string} parameter + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @instance + */ + SetParameterAction.prototype.parameter = ""; + + /** + * SetParameterAction value. + * @member {google.protobuf.IValue|null|undefined} value + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @instance + */ + SetParameterAction.prototype.value = null; + + /** + * Creates a new SetParameterAction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction} SetParameterAction instance + */ + SetParameterAction.create = function create(properties) { + return new SetParameterAction(properties); + }; + + /** + * Encodes the specified SetParameterAction message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction} message SetParameterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetParameterAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parameter != null && Object.hasOwnProperty.call(message, "parameter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parameter); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.google.protobuf.Value.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetParameterAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ISetParameterAction} message SetParameterAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetParameterAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetParameterAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @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.Fulfillment.SetParameterAction} SetParameterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetParameterAction.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.Fulfillment.SetParameterAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parameter = reader.string(); + break; + case 2: + message.value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetParameterAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction} SetParameterAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetParameterAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetParameterAction message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetParameterAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parameter != null && message.hasOwnProperty("parameter")) + if (!$util.isString(message.parameter)) + return "parameter: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + var error = $root.google.protobuf.Value.verify(message.value); + if (error) + return "value." + error; + } + return null; + }; + + /** + * Creates a SetParameterAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction} SetParameterAction + */ + SetParameterAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction(); + if (object.parameter != null) + message.parameter = String(object.parameter); + if (object.value != null) { + if (typeof object.value !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction.value: object expected"); + message.value = $root.google.protobuf.Value.fromObject(object.value); + } + return message; + }; + + /** + * Creates a plain object from a SetParameterAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction} message SetParameterAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetParameterAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parameter = ""; + object.value = null; + } + if (message.parameter != null && message.hasOwnProperty("parameter")) + object.parameter = message.parameter; + if (message.value != null && message.hasOwnProperty("value")) + object.value = $root.google.protobuf.Value.toObject(message.value, options); + return object; + }; + + /** + * Converts this SetParameterAction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.SetParameterAction + * @instance + * @returns {Object.} JSON object + */ + SetParameterAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetParameterAction; + })(); + + Fulfillment.ConditionalCases = (function() { + + /** + * Properties of a ConditionalCases. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @interface IConditionalCases + * @property {Array.|null} [cases] ConditionalCases cases + */ + + /** + * Constructs a new ConditionalCases. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment + * @classdesc Represents a ConditionalCases. + * @implements IConditionalCases + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases=} [properties] Properties to set + */ + function ConditionalCases(properties) { + this.cases = []; + 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]]; + } + + /** + * ConditionalCases cases. + * @member {Array.} cases + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @instance + */ + ConditionalCases.prototype.cases = $util.emptyArray; + + /** + * Creates a new ConditionalCases instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases} ConditionalCases instance + */ + ConditionalCases.create = function create(properties) { + return new ConditionalCases(properties); + }; + + /** + * Encodes the specified ConditionalCases message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases} message ConditionalCases message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionalCases.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cases != null && message.cases.length) + for (var i = 0; i < message.cases.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.encode(message.cases[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConditionalCases message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases} message ConditionalCases message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConditionalCases.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConditionalCases message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @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.Fulfillment.ConditionalCases} ConditionalCases + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionalCases.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.Fulfillment.ConditionalCases(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cases && message.cases.length)) + message.cases = []; + message.cases.push($root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConditionalCases message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases} ConditionalCases + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConditionalCases.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConditionalCases message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConditionalCases.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cases != null && message.hasOwnProperty("cases")) { + if (!Array.isArray(message.cases)) + return "cases: array expected"; + for (var i = 0; i < message.cases.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.verify(message.cases[i]); + if (error) + return "cases." + error; + } + } + return null; + }; + + /** + * Creates a ConditionalCases message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases} ConditionalCases + */ + ConditionalCases.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases(); + if (object.cases) { + if (!Array.isArray(object.cases)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.cases: array expected"); + message.cases = []; + for (var i = 0; i < object.cases.length; ++i) { + if (typeof object.cases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.cases: object expected"); + message.cases[i] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.fromObject(object.cases[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ConditionalCases message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases} message ConditionalCases + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConditionalCases.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cases = []; + if (message.cases && message.cases.length) { + object.cases = []; + for (var j = 0; j < message.cases.length; ++j) + object.cases[j] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.toObject(message.cases[j], options); + } + return object; + }; + + /** + * Converts this ConditionalCases to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @instance + * @returns {Object.} JSON object + */ + ConditionalCases.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ConditionalCases.Case = (function() { + + /** + * Properties of a Case. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @interface ICase + * @property {string|null} [condition] Case condition + * @property {Array.|null} [caseContent] Case caseContent + */ + + /** + * Constructs a new Case. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases + * @classdesc Represents a Case. + * @implements ICase + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase=} [properties] Properties to set + */ + function Case(properties) { + this.caseContent = []; + 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]]; + } + + /** + * Case condition. + * @member {string} condition + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @instance + */ + Case.prototype.condition = ""; + + /** + * Case caseContent. + * @member {Array.} caseContent + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @instance + */ + Case.prototype.caseContent = $util.emptyArray; + + /** + * Creates a new Case instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case} Case instance + */ + Case.create = function create(properties) { + return new Case(properties); + }; + + /** + * Encodes the specified Case message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase} message Case message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Case.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.condition != null && Object.hasOwnProperty.call(message, "condition")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition); + if (message.caseContent != null && message.caseContent.length) + for (var i = 0; i < message.caseContent.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.encode(message.caseContent[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Case message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.ICase} message Case message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Case.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Case message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @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.Fulfillment.ConditionalCases.Case} Case + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Case.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.Fulfillment.ConditionalCases.Case(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.condition = reader.string(); + break; + case 2: + if (!(message.caseContent && message.caseContent.length)) + message.caseContent = []; + message.caseContent.push($root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Case message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case} Case + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Case.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Case message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Case.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.condition != null && message.hasOwnProperty("condition")) + if (!$util.isString(message.condition)) + return "condition: string expected"; + if (message.caseContent != null && message.hasOwnProperty("caseContent")) { + if (!Array.isArray(message.caseContent)) + return "caseContent: array expected"; + for (var i = 0; i < message.caseContent.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.verify(message.caseContent[i]); + if (error) + return "caseContent." + error; + } + } + return null; + }; + + /** + * Creates a Case message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case} Case + */ + Case.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case(); + if (object.condition != null) + message.condition = String(object.condition); + if (object.caseContent) { + if (!Array.isArray(object.caseContent)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.caseContent: array expected"); + message.caseContent = []; + for (var i = 0; i < object.caseContent.length; ++i) { + if (typeof object.caseContent[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.caseContent: object expected"); + message.caseContent[i] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.fromObject(object.caseContent[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Case message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case} message Case + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Case.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.caseContent = []; + if (options.defaults) + object.condition = ""; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = message.condition; + if (message.caseContent && message.caseContent.length) { + object.caseContent = []; + for (var j = 0; j < message.caseContent.length; ++j) + object.caseContent[j] = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.toObject(message.caseContent[j], options); + } + return object; + }; + + /** + * Converts this Case to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @instance + * @returns {Object.} JSON object + */ + Case.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Case.CaseContent = (function() { + + /** + * Properties of a CaseContent. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @interface ICaseContent + * @property {google.cloud.dialogflow.cx.v3beta1.IResponseMessage|null} [message] CaseContent message + * @property {google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases|null} [additionalCases] CaseContent additionalCases + */ + + /** + * Constructs a new CaseContent. + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case + * @classdesc Represents a CaseContent. + * @implements ICaseContent + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent=} [properties] Properties to set + */ + function CaseContent(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]]; + } + + /** + * CaseContent message. + * @member {google.cloud.dialogflow.cx.v3beta1.IResponseMessage|null|undefined} message + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @instance + */ + CaseContent.prototype.message = null; + + /** + * CaseContent additionalCases. + * @member {google.cloud.dialogflow.cx.v3beta1.Fulfillment.IConditionalCases|null|undefined} additionalCases + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @instance + */ + CaseContent.prototype.additionalCases = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CaseContent casesOrMessage. + * @member {"message"|"additionalCases"|undefined} casesOrMessage + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @instance + */ + Object.defineProperty(CaseContent.prototype, "casesOrMessage", { + get: $util.oneOfGetter($oneOfFields = ["message", "additionalCases"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CaseContent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent} CaseContent instance + */ + CaseContent.create = function create(properties) { + return new CaseContent(properties); + }; + + /** + * Encodes the specified CaseContent message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent} message CaseContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CaseContent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.encode(message.message, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.additionalCases != null && Object.hasOwnProperty.call(message, "additionalCases")) + $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.encode(message.additionalCases, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CaseContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.ICaseContent} message CaseContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CaseContent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CaseContent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @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.Fulfillment.ConditionalCases.Case.CaseContent} CaseContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CaseContent.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.Fulfillment.ConditionalCases.Case.CaseContent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.decode(reader, reader.uint32()); + break; + case 2: + message.additionalCases = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CaseContent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent} CaseContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CaseContent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CaseContent message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CaseContent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.message != null && message.hasOwnProperty("message")) { + properties.casesOrMessage = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify(message.message); + if (error) + return "message." + error; + } + } + if (message.additionalCases != null && message.hasOwnProperty("additionalCases")) { + if (properties.casesOrMessage === 1) + return "casesOrMessage: multiple values"; + properties.casesOrMessage = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.verify(message.additionalCases); + if (error) + return "additionalCases." + error; + } + } + return null; + }; + + /** + * Creates a CaseContent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent} CaseContent + */ + CaseContent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent(); + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.message: object expected"); + message.message = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.fromObject(object.message); + } + if (object.additionalCases != null) { + if (typeof object.additionalCases !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent.additionalCases: object expected"); + message.additionalCases = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.fromObject(object.additionalCases); + } + return message; + }; + + /** + * Creates a plain object from a CaseContent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent} message CaseContent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CaseContent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.message != null && message.hasOwnProperty("message")) { + object.message = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.toObject(message.message, options); + if (options.oneofs) + object.casesOrMessage = "message"; + } + if (message.additionalCases != null && message.hasOwnProperty("additionalCases")) { + object.additionalCases = $root.google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.toObject(message.additionalCases, options); + if (options.oneofs) + object.casesOrMessage = "additionalCases"; + } + return object; + }; + + /** + * Converts this CaseContent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Fulfillment.ConditionalCases.Case.CaseContent + * @instance + * @returns {Object.} JSON object + */ + CaseContent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CaseContent; + })(); + + return Case; + })(); + + return ConditionalCases; + })(); + + return Fulfillment; + })(); + + v3beta1.ResponseMessage = (function() { + + /** + * Properties of a ResponseMessage. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IResponseMessage + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText|null} [text] ResponseMessage text + * @property {google.protobuf.IStruct|null} [payload] ResponseMessage payload + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess|null} [conversationSuccess] ResponseMessage conversationSuccess + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText|null} [outputAudioText] ResponseMessage outputAudioText + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff|null} [liveAgentHandoff] ResponseMessage liveAgentHandoff + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction|null} [endInteraction] ResponseMessage endInteraction + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio|null} [playAudio] ResponseMessage playAudio + * @property {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio|null} [mixedAudio] ResponseMessage mixedAudio + */ + + /** + * Constructs a new ResponseMessage. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ResponseMessage. + * @implements IResponseMessage + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IResponseMessage=} [properties] Properties to set + */ + function ResponseMessage(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]]; + } + + /** + * ResponseMessage text. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText|null|undefined} text + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.text = null; + + /** + * ResponseMessage payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.payload = null; + + /** + * ResponseMessage conversationSuccess. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess|null|undefined} conversationSuccess + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.conversationSuccess = null; + + /** + * ResponseMessage outputAudioText. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText|null|undefined} outputAudioText + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.outputAudioText = null; + + /** + * ResponseMessage liveAgentHandoff. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff|null|undefined} liveAgentHandoff + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.liveAgentHandoff = null; + + /** + * ResponseMessage endInteraction. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction|null|undefined} endInteraction + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.endInteraction = null; + + /** + * ResponseMessage playAudio. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio|null|undefined} playAudio + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.playAudio = null; + + /** + * ResponseMessage mixedAudio. + * @member {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio|null|undefined} mixedAudio + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.mixedAudio = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ResponseMessage message. + * @member {"text"|"payload"|"conversationSuccess"|"outputAudioText"|"liveAgentHandoff"|"endInteraction"|"playAudio"|"mixedAudio"|undefined} message + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + */ + Object.defineProperty(ResponseMessage.prototype, "message", { + get: $util.oneOfGetter($oneOfFields = ["text", "payload", "conversationSuccess", "outputAudioText", "liveAgentHandoff", "endInteraction", "playAudio", "mixedAudio"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ResponseMessage instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IResponseMessage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage} ResponseMessage instance + */ + ResponseMessage.create = function create(properties) { + return new ResponseMessage(properties); + }; + + /** + * Encodes the specified ResponseMessage message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IResponseMessage} message ResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputAudioText != null && Object.hasOwnProperty.call(message, "outputAudioText")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.encode(message.outputAudioText, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.conversationSuccess != null && Object.hasOwnProperty.call(message, "conversationSuccess")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.encode(message.conversationSuccess, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.liveAgentHandoff != null && Object.hasOwnProperty.call(message, "liveAgentHandoff")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.encode(message.liveAgentHandoff, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.endInteraction != null && Object.hasOwnProperty.call(message, "endInteraction")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.encode(message.endInteraction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.playAudio != null && Object.hasOwnProperty.call(message, "playAudio")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.encode(message.playAudio, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.mixedAudio != null && Object.hasOwnProperty.call(message, "mixedAudio")) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.encode(message.mixedAudio, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResponseMessage message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IResponseMessage} message ResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @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.ResponseMessage} ResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMessage.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.ResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.decode(reader, reader.uint32()); + break; + case 2: + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 9: + message.conversationSuccess = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.decode(reader, reader.uint32()); + break; + case 8: + message.outputAudioText = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.decode(reader, reader.uint32()); + break; + case 10: + message.liveAgentHandoff = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.decode(reader, reader.uint32()); + break; + case 11: + message.endInteraction = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.decode(reader, reader.uint32()); + break; + case 12: + message.playAudio = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.decode(reader, reader.uint32()); + break; + case 13: + message.mixedAudio = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage} ResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseMessage message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + } + if (message.conversationSuccess != null && message.hasOwnProperty("conversationSuccess")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.verify(message.conversationSuccess); + if (error) + return "conversationSuccess." + error; + } + } + if (message.outputAudioText != null && message.hasOwnProperty("outputAudioText")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.verify(message.outputAudioText); + if (error) + return "outputAudioText." + error; + } + } + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.verify(message.liveAgentHandoff); + if (error) + return "liveAgentHandoff." + error; + } + } + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.verify(message.endInteraction); + if (error) + return "endInteraction." + error; + } + } + if (message.playAudio != null && message.hasOwnProperty("playAudio")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.verify(message.playAudio); + if (error) + return "playAudio." + error; + } + } + if (message.mixedAudio != null && message.hasOwnProperty("mixedAudio")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.verify(message.mixedAudio); + if (error) + return "mixedAudio." + error; + } + } + return null; + }; + + /** + * Creates a ResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage} ResponseMessage + */ + ResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.text: object expected"); + message.text = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.fromObject(object.text); + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.conversationSuccess != null) { + if (typeof object.conversationSuccess !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.conversationSuccess: object expected"); + message.conversationSuccess = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.fromObject(object.conversationSuccess); + } + if (object.outputAudioText != null) { + if (typeof object.outputAudioText !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.outputAudioText: object expected"); + message.outputAudioText = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.fromObject(object.outputAudioText); + } + if (object.liveAgentHandoff != null) { + if (typeof object.liveAgentHandoff !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.liveAgentHandoff: object expected"); + message.liveAgentHandoff = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.fromObject(object.liveAgentHandoff); + } + if (object.endInteraction != null) { + if (typeof object.endInteraction !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.endInteraction: object expected"); + message.endInteraction = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.fromObject(object.endInteraction); + } + if (object.playAudio != null) { + if (typeof object.playAudio !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.playAudio: object expected"); + message.playAudio = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.fromObject(object.playAudio); + } + if (object.mixedAudio != null) { + if (typeof object.mixedAudio !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.mixedAudio: object expected"); + message.mixedAudio = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.fromObject(object.mixedAudio); + } + return message; + }; + + /** + * Creates a plain object from a ResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage} message ResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.toObject(message.text, options); + if (options.oneofs) + object.message = "text"; + } + if (message.payload != null && message.hasOwnProperty("payload")) { + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (options.oneofs) + object.message = "payload"; + } + if (message.outputAudioText != null && message.hasOwnProperty("outputAudioText")) { + object.outputAudioText = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.toObject(message.outputAudioText, options); + if (options.oneofs) + object.message = "outputAudioText"; + } + if (message.conversationSuccess != null && message.hasOwnProperty("conversationSuccess")) { + object.conversationSuccess = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.toObject(message.conversationSuccess, options); + if (options.oneofs) + object.message = "conversationSuccess"; + } + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) { + object.liveAgentHandoff = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.toObject(message.liveAgentHandoff, options); + if (options.oneofs) + object.message = "liveAgentHandoff"; + } + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) { + object.endInteraction = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.toObject(message.endInteraction, options); + if (options.oneofs) + object.message = "endInteraction"; + } + if (message.playAudio != null && message.hasOwnProperty("playAudio")) { + object.playAudio = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.toObject(message.playAudio, options); + if (options.oneofs) + object.message = "playAudio"; + } + if (message.mixedAudio != null && message.hasOwnProperty("mixedAudio")) { + object.mixedAudio = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.toObject(message.mixedAudio, options); + if (options.oneofs) + object.message = "mixedAudio"; + } + return object; + }; + + /** + * Converts this ResponseMessage to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @instance + * @returns {Object.} JSON object + */ + ResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ResponseMessage.Text = (function() { + + /** + * Properties of a Text. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface IText + * @property {Array.|null} [text] Text text + * @property {boolean|null} [allowPlaybackInterruption] Text allowPlaybackInterruption + */ + + /** + * Constructs a new Text. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents a Text. + * @implements IText + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText=} [properties] Properties to set + */ + function Text(properties) { + this.text = []; + 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]]; + } + + /** + * Text text. + * @member {Array.} text + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @instance + */ + Text.prototype.text = $util.emptyArray; + + /** + * Text allowPlaybackInterruption. + * @member {boolean} allowPlaybackInterruption + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @instance + */ + Text.prototype.allowPlaybackInterruption = false; + + /** + * Creates a new Text instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text} Text instance + */ + Text.create = function create(properties) { + return new Text(properties); + }; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + if (message.allowPlaybackInterruption != null && Object.hasOwnProperty.call(message, "allowPlaybackInterruption")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowPlaybackInterruption); + return writer; + }; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Text message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @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.ResponseMessage.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.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.ResponseMessage.Text(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + case 2: + message.allowPlaybackInterruption = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Text message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Text.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + if (typeof message.allowPlaybackInterruption !== "boolean") + return "allowPlaybackInterruption: boolean expected"; + return null; + }; + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text} Text + */ + Text.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + if (object.allowPlaybackInterruption != null) + message.allowPlaybackInterruption = Boolean(object.allowPlaybackInterruption); + return message; + }; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text} message Text + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Text.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.text = []; + if (options.defaults) + object.allowPlaybackInterruption = false; + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + object.allowPlaybackInterruption = message.allowPlaybackInterruption; + return object; + }; + + /** + * Converts this Text to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.Text + * @instance + * @returns {Object.} JSON object + */ + Text.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Text; + })(); + + ResponseMessage.LiveAgentHandoff = (function() { + + /** + * Properties of a LiveAgentHandoff. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface ILiveAgentHandoff + * @property {google.protobuf.IStruct|null} [metadata] LiveAgentHandoff metadata + */ + + /** + * Constructs a new LiveAgentHandoff. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents a LiveAgentHandoff. + * @implements ILiveAgentHandoff + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff=} [properties] Properties to set + */ + function LiveAgentHandoff(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]]; + } + + /** + * LiveAgentHandoff metadata. + * @member {google.protobuf.IStruct|null|undefined} metadata + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @instance + */ + LiveAgentHandoff.prototype.metadata = null; + + /** + * Creates a new LiveAgentHandoff instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff instance + */ + LiveAgentHandoff.create = function create(properties) { + return new LiveAgentHandoff(properties); + }; + + /** + * Encodes the specified LiveAgentHandoff message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff} message LiveAgentHandoff message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LiveAgentHandoff.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Struct.encode(message.metadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LiveAgentHandoff message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ILiveAgentHandoff} message LiveAgentHandoff message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LiveAgentHandoff.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @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.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LiveAgentHandoff.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.ResponseMessage.LiveAgentHandoff(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LiveAgentHandoff.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LiveAgentHandoff message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LiveAgentHandoff.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Struct.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a LiveAgentHandoff message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff + */ + LiveAgentHandoff.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff(); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff.metadata: object expected"); + message.metadata = $root.google.protobuf.Struct.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a LiveAgentHandoff message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff} message LiveAgentHandoff + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LiveAgentHandoff.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Struct.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this LiveAgentHandoff to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.LiveAgentHandoff + * @instance + * @returns {Object.} JSON object + */ + LiveAgentHandoff.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LiveAgentHandoff; + })(); + + ResponseMessage.ConversationSuccess = (function() { + + /** + * Properties of a ConversationSuccess. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface IConversationSuccess + * @property {google.protobuf.IStruct|null} [metadata] ConversationSuccess metadata + */ + + /** + * Constructs a new ConversationSuccess. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents a ConversationSuccess. + * @implements IConversationSuccess + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess=} [properties] Properties to set + */ + function ConversationSuccess(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]]; + } + + /** + * ConversationSuccess metadata. + * @member {google.protobuf.IStruct|null|undefined} metadata + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @instance + */ + ConversationSuccess.prototype.metadata = null; + + /** + * Creates a new ConversationSuccess instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess} ConversationSuccess instance + */ + ConversationSuccess.create = function create(properties) { + return new ConversationSuccess(properties); + }; + + /** + * Encodes the specified ConversationSuccess message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess} message ConversationSuccess message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationSuccess.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Struct.encode(message.metadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConversationSuccess message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IConversationSuccess} message ConversationSuccess message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationSuccess.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationSuccess message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @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.ResponseMessage.ConversationSuccess} ConversationSuccess + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationSuccess.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.ResponseMessage.ConversationSuccess(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationSuccess message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess} ConversationSuccess + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationSuccess.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationSuccess message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationSuccess.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Struct.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a ConversationSuccess message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess} ConversationSuccess + */ + ConversationSuccess.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess(); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess.metadata: object expected"); + message.metadata = $root.google.protobuf.Struct.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a ConversationSuccess message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess} message ConversationSuccess + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationSuccess.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Struct.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this ConversationSuccess to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.ConversationSuccess + * @instance + * @returns {Object.} JSON object + */ + ConversationSuccess.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ConversationSuccess; + })(); + + ResponseMessage.OutputAudioText = (function() { + + /** + * Properties of an OutputAudioText. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface IOutputAudioText + * @property {string|null} [text] OutputAudioText text + * @property {string|null} [ssml] OutputAudioText ssml + * @property {boolean|null} [allowPlaybackInterruption] OutputAudioText allowPlaybackInterruption + */ + + /** + * Constructs a new OutputAudioText. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents an OutputAudioText. + * @implements IOutputAudioText + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText=} [properties] Properties to set + */ + function OutputAudioText(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]]; + } + + /** + * OutputAudioText text. + * @member {string} text + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @instance + */ + OutputAudioText.prototype.text = ""; + + /** + * OutputAudioText ssml. + * @member {string} ssml + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @instance + */ + OutputAudioText.prototype.ssml = ""; + + /** + * OutputAudioText allowPlaybackInterruption. + * @member {boolean} allowPlaybackInterruption + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @instance + */ + OutputAudioText.prototype.allowPlaybackInterruption = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * OutputAudioText source. + * @member {"text"|"ssml"|undefined} source + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @instance + */ + Object.defineProperty(OutputAudioText.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["text", "ssml"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new OutputAudioText instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText} OutputAudioText instance + */ + OutputAudioText.create = function create(properties) { + return new OutputAudioText(properties); + }; + + /** + * Encodes the specified OutputAudioText message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText} message OutputAudioText message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioText.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.ssml != null && Object.hasOwnProperty.call(message, "ssml")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ssml); + if (message.allowPlaybackInterruption != null && Object.hasOwnProperty.call(message, "allowPlaybackInterruption")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowPlaybackInterruption); + return writer; + }; + + /** + * Encodes the specified OutputAudioText message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IOutputAudioText} message OutputAudioText message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioText.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputAudioText message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @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.ResponseMessage.OutputAudioText} OutputAudioText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioText.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.ResponseMessage.OutputAudioText(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + case 2: + message.ssml = reader.string(); + break; + case 3: + message.allowPlaybackInterruption = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputAudioText message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText} OutputAudioText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioText.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputAudioText message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputAudioText.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.source = 1; + if (!$util.isString(message.text)) + return "text: string expected"; + } + if (message.ssml != null && message.hasOwnProperty("ssml")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!$util.isString(message.ssml)) + return "ssml: string expected"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + if (typeof message.allowPlaybackInterruption !== "boolean") + return "allowPlaybackInterruption: boolean expected"; + return null; + }; + + /** + * Creates an OutputAudioText message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText} OutputAudioText + */ + OutputAudioText.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText(); + if (object.text != null) + message.text = String(object.text); + if (object.ssml != null) + message.ssml = String(object.ssml); + if (object.allowPlaybackInterruption != null) + message.allowPlaybackInterruption = Boolean(object.allowPlaybackInterruption); + return message; + }; + + /** + * Creates a plain object from an OutputAudioText message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText} message OutputAudioText + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputAudioText.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.allowPlaybackInterruption = false; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = message.text; + if (options.oneofs) + object.source = "text"; + } + if (message.ssml != null && message.hasOwnProperty("ssml")) { + object.ssml = message.ssml; + if (options.oneofs) + object.source = "ssml"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + object.allowPlaybackInterruption = message.allowPlaybackInterruption; + return object; + }; + + /** + * Converts this OutputAudioText to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.OutputAudioText + * @instance + * @returns {Object.} JSON object + */ + OutputAudioText.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OutputAudioText; + })(); + + ResponseMessage.MixedAudio = (function() { + + /** + * Properties of a MixedAudio. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface IMixedAudio + * @property {Array.|null} [segments] MixedAudio segments + */ + + /** + * Constructs a new MixedAudio. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents a MixedAudio. + * @implements IMixedAudio + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio=} [properties] Properties to set + */ + function MixedAudio(properties) { + this.segments = []; + 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]]; + } + + /** + * MixedAudio segments. + * @member {Array.} segments + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @instance + */ + MixedAudio.prototype.segments = $util.emptyArray; + + /** + * Creates a new MixedAudio instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} MixedAudio instance + */ + MixedAudio.create = function create(properties) { + return new MixedAudio(properties); + }; + + /** + * Encodes the specified MixedAudio message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio} message MixedAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MixedAudio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.segments != null && message.segments.length) + for (var i = 0; i < message.segments.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.encode(message.segments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MixedAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IMixedAudio} message MixedAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MixedAudio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MixedAudio message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @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.ResponseMessage.MixedAudio} MixedAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MixedAudio.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.ResponseMessage.MixedAudio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.segments && message.segments.length)) + message.segments = []; + message.segments.push($root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MixedAudio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} MixedAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MixedAudio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MixedAudio message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MixedAudio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.segments != null && message.hasOwnProperty("segments")) { + if (!Array.isArray(message.segments)) + return "segments: array expected"; + for (var i = 0; i < message.segments.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.verify(message.segments[i]); + if (error) + return "segments." + error; + } + } + return null; + }; + + /** + * Creates a MixedAudio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} MixedAudio + */ + MixedAudio.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio(); + if (object.segments) { + if (!Array.isArray(object.segments)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.segments: array expected"); + message.segments = []; + for (var i = 0; i < object.segments.length; ++i) { + if (typeof object.segments[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.segments: object expected"); + message.segments[i] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.fromObject(object.segments[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MixedAudio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio} message MixedAudio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MixedAudio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.segments = []; + if (message.segments && message.segments.length) { + object.segments = []; + for (var j = 0; j < message.segments.length; ++j) + object.segments[j] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.toObject(message.segments[j], options); + } + return object; + }; + + /** + * Converts this MixedAudio to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @instance + * @returns {Object.} JSON object + */ + MixedAudio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + MixedAudio.Segment = (function() { + + /** + * Properties of a Segment. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @interface ISegment + * @property {Uint8Array|null} [audio] Segment audio + * @property {string|null} [uri] Segment uri + * @property {boolean|null} [allowPlaybackInterruption] Segment allowPlaybackInterruption + */ + + /** + * Constructs a new Segment. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio + * @classdesc Represents a Segment. + * @implements ISegment + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment=} [properties] Properties to set + */ + function Segment(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]]; + } + + /** + * Segment audio. + * @member {Uint8Array} audio + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Segment.prototype.audio = $util.newBuffer([]); + + /** + * Segment uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Segment.prototype.uri = ""; + + /** + * Segment allowPlaybackInterruption. + * @member {boolean} allowPlaybackInterruption + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Segment.prototype.allowPlaybackInterruption = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Segment content. + * @member {"audio"|"uri"|undefined} content + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Object.defineProperty(Segment.prototype, "content", { + get: $util.oneOfGetter($oneOfFields = ["audio", "uri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Segment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} Segment instance + */ + Segment.create = function create(properties) { + return new Segment(properties); + }; + + /** + * Encodes the specified Segment message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment} message Segment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Segment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.audio); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + if (message.allowPlaybackInterruption != null && Object.hasOwnProperty.call(message, "allowPlaybackInterruption")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowPlaybackInterruption); + return writer; + }; + + /** + * Encodes the specified Segment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.ISegment} message Segment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Segment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Segment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @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.ResponseMessage.MixedAudio.Segment} Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Segment.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.ResponseMessage.MixedAudio.Segment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.audio = reader.bytes(); + break; + case 2: + message.uri = reader.string(); + break; + case 3: + message.allowPlaybackInterruption = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Segment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Segment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Segment message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Segment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.audio != null && message.hasOwnProperty("audio")) { + properties.content = 1; + if (!(message.audio && typeof message.audio.length === "number" || $util.isString(message.audio))) + return "audio: buffer expected"; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + if (properties.content === 1) + return "content: multiple values"; + properties.content = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + if (typeof message.allowPlaybackInterruption !== "boolean") + return "allowPlaybackInterruption: boolean expected"; + return null; + }; + + /** + * Creates a Segment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} Segment + */ + Segment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment(); + if (object.audio != null) + if (typeof object.audio === "string") + $util.base64.decode(object.audio, message.audio = $util.newBuffer($util.base64.length(object.audio)), 0); + else if (object.audio.length) + message.audio = object.audio; + if (object.uri != null) + message.uri = String(object.uri); + if (object.allowPlaybackInterruption != null) + message.allowPlaybackInterruption = Boolean(object.allowPlaybackInterruption); + return message; + }; + + /** + * Creates a plain object from a Segment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment} message Segment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Segment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.allowPlaybackInterruption = false; + if (message.audio != null && message.hasOwnProperty("audio")) { + object.audio = options.bytes === String ? $util.base64.encode(message.audio, 0, message.audio.length) : options.bytes === Array ? Array.prototype.slice.call(message.audio) : message.audio; + if (options.oneofs) + object.content = "audio"; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object.content = "uri"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + object.allowPlaybackInterruption = message.allowPlaybackInterruption; + return object; + }; + + /** + * Converts this Segment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.MixedAudio.Segment + * @instance + * @returns {Object.} JSON object + */ + Segment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Segment; + })(); + + return MixedAudio; + })(); + + ResponseMessage.EndInteraction = (function() { + + /** + * Properties of an EndInteraction. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface IEndInteraction + */ + + /** + * Constructs a new EndInteraction. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents an EndInteraction. + * @implements IEndInteraction + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction=} [properties] Properties to set + */ + function EndInteraction(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]]; + } + + /** + * Creates a new EndInteraction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} EndInteraction instance + */ + EndInteraction.create = function create(properties) { + return new EndInteraction(properties); + }; + + /** + * Encodes the specified EndInteraction message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction} message EndInteraction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndInteraction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified EndInteraction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IEndInteraction} message EndInteraction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndInteraction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EndInteraction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @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.ResponseMessage.EndInteraction} EndInteraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndInteraction.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.ResponseMessage.EndInteraction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EndInteraction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} EndInteraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndInteraction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EndInteraction message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EndInteraction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an EndInteraction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} EndInteraction + */ + EndInteraction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction) + return object; + return new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction(); + }; + + /** + * Creates a plain object from an EndInteraction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction} message EndInteraction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EndInteraction.toObject = function toObject() { + return {}; + }; + + /** + * Converts this EndInteraction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.EndInteraction + * @instance + * @returns {Object.} JSON object + */ + EndInteraction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EndInteraction; + })(); + + ResponseMessage.PlayAudio = (function() { + + /** + * Properties of a PlayAudio. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @interface IPlayAudio + * @property {string|null} [audioUri] PlayAudio audioUri + * @property {boolean|null} [allowPlaybackInterruption] PlayAudio allowPlaybackInterruption + */ + + /** + * Constructs a new PlayAudio. + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage + * @classdesc Represents a PlayAudio. + * @implements IPlayAudio + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio=} [properties] Properties to set + */ + function PlayAudio(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]]; + } + + /** + * PlayAudio audioUri. + * @member {string} audioUri + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @instance + */ + PlayAudio.prototype.audioUri = ""; + + /** + * PlayAudio allowPlaybackInterruption. + * @member {boolean} allowPlaybackInterruption + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @instance + */ + PlayAudio.prototype.allowPlaybackInterruption = false; + + /** + * Creates a new PlayAudio instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} PlayAudio instance + */ + PlayAudio.create = function create(properties) { + return new PlayAudio(properties); + }; + + /** + * Encodes the specified PlayAudio message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio} message PlayAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PlayAudio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioUri != null && Object.hasOwnProperty.call(message, "audioUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.audioUri); + if (message.allowPlaybackInterruption != null && Object.hasOwnProperty.call(message, "allowPlaybackInterruption")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowPlaybackInterruption); + return writer; + }; + + /** + * Encodes the specified PlayAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.IPlayAudio} message PlayAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PlayAudio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PlayAudio message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @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.ResponseMessage.PlayAudio} PlayAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PlayAudio.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.ResponseMessage.PlayAudio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.audioUri = reader.string(); + break; + case 2: + message.allowPlaybackInterruption = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PlayAudio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} PlayAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PlayAudio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PlayAudio message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PlayAudio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioUri != null && message.hasOwnProperty("audioUri")) + if (!$util.isString(message.audioUri)) + return "audioUri: string expected"; + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + if (typeof message.allowPlaybackInterruption !== "boolean") + return "allowPlaybackInterruption: boolean expected"; + return null; + }; + + /** + * Creates a PlayAudio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} PlayAudio + */ + PlayAudio.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio(); + if (object.audioUri != null) + message.audioUri = String(object.audioUri); + if (object.allowPlaybackInterruption != null) + message.allowPlaybackInterruption = Boolean(object.allowPlaybackInterruption); + return message; + }; + + /** + * Creates a plain object from a PlayAudio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio} message PlayAudio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PlayAudio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.audioUri = ""; + object.allowPlaybackInterruption = false; + } + if (message.audioUri != null && message.hasOwnProperty("audioUri")) + object.audioUri = message.audioUri; + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + object.allowPlaybackInterruption = message.allowPlaybackInterruption; + return object; + }; + + /** + * Converts this PlayAudio to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ResponseMessage.PlayAudio + * @instance + * @returns {Object.} JSON object + */ + PlayAudio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PlayAudio; + })(); + + return ResponseMessage; + })(); + + v3beta1.SpeechWordInfo = (function() { + + /** + * Properties of a SpeechWordInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ISpeechWordInfo + * @property {string|null} [word] SpeechWordInfo word + * @property {google.protobuf.IDuration|null} [startOffset] SpeechWordInfo startOffset + * @property {google.protobuf.IDuration|null} [endOffset] SpeechWordInfo endOffset + * @property {number|null} [confidence] SpeechWordInfo confidence + */ + + /** + * Constructs a new SpeechWordInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SpeechWordInfo. + * @implements ISpeechWordInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo=} [properties] Properties to set + */ + function SpeechWordInfo(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]]; + } + + /** + * SpeechWordInfo word. + * @member {string} word + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.word = ""; + + /** + * SpeechWordInfo startOffset. + * @member {google.protobuf.IDuration|null|undefined} startOffset + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.startOffset = null; + + /** + * SpeechWordInfo endOffset. + * @member {google.protobuf.IDuration|null|undefined} endOffset + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.endOffset = null; + + /** + * SpeechWordInfo confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.confidence = 0; + + /** + * Creates a new SpeechWordInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo} SpeechWordInfo instance + */ + SpeechWordInfo.create = function create(properties) { + return new SpeechWordInfo(properties); + }; + + /** + * Encodes the specified SpeechWordInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo} message SpeechWordInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechWordInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startOffset != null && Object.hasOwnProperty.call(message, "startOffset")) + $root.google.protobuf.Duration.encode(message.startOffset, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endOffset != null && Object.hasOwnProperty.call(message, "endOffset")) + $root.google.protobuf.Duration.encode(message.endOffset, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.word != null && Object.hasOwnProperty.call(message, "word")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.word); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified SpeechWordInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISpeechWordInfo} message SpeechWordInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechWordInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @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.SpeechWordInfo} SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechWordInfo.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.SpeechWordInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.word = reader.string(); + break; + case 1: + message.startOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 2: + message.endOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 4: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo} SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechWordInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechWordInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechWordInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.word != null && message.hasOwnProperty("word")) + if (!$util.isString(message.word)) + return "word: string expected"; + if (message.startOffset != null && message.hasOwnProperty("startOffset")) { + var error = $root.google.protobuf.Duration.verify(message.startOffset); + if (error) + return "startOffset." + error; + } + if (message.endOffset != null && message.hasOwnProperty("endOffset")) { + var error = $root.google.protobuf.Duration.verify(message.endOffset); + if (error) + return "endOffset." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a SpeechWordInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo} SpeechWordInfo + */ + SpeechWordInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo(); + if (object.word != null) + message.word = String(object.word); + if (object.startOffset != null) { + if (typeof object.startOffset !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.startOffset: object expected"); + message.startOffset = $root.google.protobuf.Duration.fromObject(object.startOffset); + } + if (object.endOffset != null) { + if (typeof object.endOffset !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.endOffset: object expected"); + message.endOffset = $root.google.protobuf.Duration.fromObject(object.endOffset); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a SpeechWordInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo} message SpeechWordInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechWordInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startOffset = null; + object.endOffset = null; + object.word = ""; + object.confidence = 0; + } + if (message.startOffset != null && message.hasOwnProperty("startOffset")) + object.startOffset = $root.google.protobuf.Duration.toObject(message.startOffset, options); + if (message.endOffset != null && message.hasOwnProperty("endOffset")) + object.endOffset = $root.google.protobuf.Duration.toObject(message.endOffset, options); + if (message.word != null && message.hasOwnProperty("word")) + object.word = message.word; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this SpeechWordInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo + * @instance + * @returns {Object.} JSON object + */ + SpeechWordInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SpeechWordInfo; + })(); + + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.cx.v3beta1.AudioEncoding + * @enum {number} + * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value + * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value + * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value + * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value + * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value + * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value + * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value + * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value + */ + v3beta1.AudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; + values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; + values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; + values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; + values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; + values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; + return values; + })(); + + v3beta1.InputAudioConfig = (function() { + + /** + * Properties of an InputAudioConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IInputAudioConfig + * @property {google.cloud.dialogflow.cx.v3beta1.AudioEncoding|null} [audioEncoding] InputAudioConfig audioEncoding + * @property {number|null} [sampleRateHertz] InputAudioConfig sampleRateHertz + * @property {boolean|null} [enableWordInfo] InputAudioConfig enableWordInfo + * @property {Array.|null} [phraseHints] InputAudioConfig phraseHints + * @property {string|null} [model] InputAudioConfig model + * @property {google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant|null} [modelVariant] InputAudioConfig modelVariant + * @property {boolean|null} [singleUtterance] InputAudioConfig singleUtterance + */ + + /** + * Constructs a new InputAudioConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an InputAudioConfig. + * @implements IInputAudioConfig + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig=} [properties] Properties to set + */ + function InputAudioConfig(properties) { + this.phraseHints = []; + 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]]; + } + + /** + * InputAudioConfig audioEncoding. + * @member {google.cloud.dialogflow.cx.v3beta1.AudioEncoding} audioEncoding + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.audioEncoding = 0; + + /** + * InputAudioConfig sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.sampleRateHertz = 0; + + /** + * InputAudioConfig enableWordInfo. + * @member {boolean} enableWordInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.enableWordInfo = false; + + /** + * InputAudioConfig phraseHints. + * @member {Array.} phraseHints + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.phraseHints = $util.emptyArray; + + /** + * InputAudioConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.model = ""; + + /** + * InputAudioConfig modelVariant. + * @member {google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant} modelVariant + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.modelVariant = 0; + + /** + * InputAudioConfig singleUtterance. + * @member {boolean} singleUtterance + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.singleUtterance = false; + + /** + * Creates a new InputAudioConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.InputAudioConfig} InputAudioConfig instance + */ + InputAudioConfig.create = function create(properties) { + return new InputAudioConfig(properties); + }; + + /** + * Encodes the specified InputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig} message InputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputAudioConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioEncoding != null && Object.hasOwnProperty.call(message, "audioEncoding")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.audioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sampleRateHertz); + if (message.phraseHints != null && message.phraseHints.length) + for (var i = 0; i < message.phraseHints.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.phraseHints[i]); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.model); + if (message.singleUtterance != null && Object.hasOwnProperty.call(message, "singleUtterance")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.singleUtterance); + if (message.modelVariant != null && Object.hasOwnProperty.call(message, "modelVariant")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.modelVariant); + if (message.enableWordInfo != null && Object.hasOwnProperty.call(message, "enableWordInfo")) + writer.uint32(/* id 13, wireType 0 =*/104).bool(message.enableWordInfo); + return writer; + }; + + /** + * Encodes the specified InputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig} message InputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputAudioConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @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.InputAudioConfig} InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputAudioConfig.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.InputAudioConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.audioEncoding = reader.int32(); + break; + case 2: + message.sampleRateHertz = reader.int32(); + break; + case 13: + message.enableWordInfo = reader.bool(); + break; + case 4: + if (!(message.phraseHints && message.phraseHints.length)) + message.phraseHints = []; + message.phraseHints.push(reader.string()); + break; + case 7: + message.model = reader.string(); + break; + case 10: + message.modelVariant = reader.int32(); + break; + case 8: + message.singleUtterance = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.InputAudioConfig} InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputAudioConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputAudioConfig message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputAudioConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + switch (message.audioEncoding) { + default: + return "audioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.enableWordInfo != null && message.hasOwnProperty("enableWordInfo")) + if (typeof message.enableWordInfo !== "boolean") + return "enableWordInfo: boolean expected"; + if (message.phraseHints != null && message.hasOwnProperty("phraseHints")) { + if (!Array.isArray(message.phraseHints)) + return "phraseHints: array expected"; + for (var i = 0; i < message.phraseHints.length; ++i) + if (!$util.isString(message.phraseHints[i])) + return "phraseHints: string[] expected"; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.modelVariant != null && message.hasOwnProperty("modelVariant")) + switch (message.modelVariant) { + default: + return "modelVariant: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + if (typeof message.singleUtterance !== "boolean") + return "singleUtterance: boolean expected"; + return null; + }; + + /** + * Creates an InputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.InputAudioConfig} InputAudioConfig + */ + InputAudioConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig(); + switch (object.audioEncoding) { + case "AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.audioEncoding = 0; + break; + case "AUDIO_ENCODING_LINEAR_16": + case 1: + message.audioEncoding = 1; + break; + case "AUDIO_ENCODING_FLAC": + case 2: + message.audioEncoding = 2; + break; + case "AUDIO_ENCODING_MULAW": + case 3: + message.audioEncoding = 3; + break; + case "AUDIO_ENCODING_AMR": + case 4: + message.audioEncoding = 4; + break; + case "AUDIO_ENCODING_AMR_WB": + case 5: + message.audioEncoding = 5; + break; + case "AUDIO_ENCODING_OGG_OPUS": + case 6: + message.audioEncoding = 6; + break; + case "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": + case 7: + message.audioEncoding = 7; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.enableWordInfo != null) + message.enableWordInfo = Boolean(object.enableWordInfo); + if (object.phraseHints) { + if (!Array.isArray(object.phraseHints)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.phraseHints: array expected"); + message.phraseHints = []; + for (var i = 0; i < object.phraseHints.length; ++i) + message.phraseHints[i] = String(object.phraseHints[i]); + } + if (object.model != null) + message.model = String(object.model); + switch (object.modelVariant) { + case "SPEECH_MODEL_VARIANT_UNSPECIFIED": + case 0: + message.modelVariant = 0; + break; + case "USE_BEST_AVAILABLE": + case 1: + message.modelVariant = 1; + break; + case "USE_STANDARD": + case 2: + message.modelVariant = 2; + break; + case "USE_ENHANCED": + case 3: + message.modelVariant = 3; + break; + } + if (object.singleUtterance != null) + message.singleUtterance = Boolean(object.singleUtterance); + return message; + }; + + /** + * Creates a plain object from an InputAudioConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.InputAudioConfig} message InputAudioConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputAudioConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.phraseHints = []; + if (options.defaults) { + object.audioEncoding = options.enums === String ? "AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + object.model = ""; + object.singleUtterance = false; + object.modelVariant = options.enums === String ? "SPEECH_MODEL_VARIANT_UNSPECIFIED" : 0; + object.enableWordInfo = false; + } + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + object.audioEncoding = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.AudioEncoding[message.audioEncoding] : message.audioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + if (message.phraseHints && message.phraseHints.length) { + object.phraseHints = []; + for (var j = 0; j < message.phraseHints.length; ++j) + object.phraseHints[j] = message.phraseHints[j]; + } + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + object.singleUtterance = message.singleUtterance; + if (message.modelVariant != null && message.hasOwnProperty("modelVariant")) + object.modelVariant = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant[message.modelVariant] : message.modelVariant; + if (message.enableWordInfo != null && message.hasOwnProperty("enableWordInfo")) + object.enableWordInfo = message.enableWordInfo; + return object; + }; + + /** + * Converts this InputAudioConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.InputAudioConfig + * @instance + * @returns {Object.} JSON object + */ + InputAudioConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InputAudioConfig; + })(); + + /** + * SpeechModelVariant enum. + * @name google.cloud.dialogflow.cx.v3beta1.SpeechModelVariant + * @enum {number} + * @property {number} SPEECH_MODEL_VARIANT_UNSPECIFIED=0 SPEECH_MODEL_VARIANT_UNSPECIFIED value + * @property {number} USE_BEST_AVAILABLE=1 USE_BEST_AVAILABLE value + * @property {number} USE_STANDARD=2 USE_STANDARD value + * @property {number} USE_ENHANCED=3 USE_ENHANCED value + */ + v3beta1.SpeechModelVariant = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SPEECH_MODEL_VARIANT_UNSPECIFIED"] = 0; + values[valuesById[1] = "USE_BEST_AVAILABLE"] = 1; + values[valuesById[2] = "USE_STANDARD"] = 2; + values[valuesById[3] = "USE_ENHANCED"] = 3; + return values; + })(); + + v3beta1.VoiceSelectionParams = (function() { + + /** + * Properties of a VoiceSelectionParams. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IVoiceSelectionParams + * @property {string|null} [name] VoiceSelectionParams name + * @property {google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender|null} [ssmlGender] VoiceSelectionParams ssmlGender + */ + + /** + * Constructs a new VoiceSelectionParams. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a VoiceSelectionParams. + * @implements IVoiceSelectionParams + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams=} [properties] Properties to set + */ + function VoiceSelectionParams(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]]; + } + + /** + * VoiceSelectionParams name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @instance + */ + VoiceSelectionParams.prototype.name = ""; + + /** + * VoiceSelectionParams ssmlGender. + * @member {google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender} ssmlGender + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @instance + */ + VoiceSelectionParams.prototype.ssmlGender = 0; + + /** + * Creates a new VoiceSelectionParams instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams} VoiceSelectionParams instance + */ + VoiceSelectionParams.create = function create(properties) { + return new VoiceSelectionParams(properties); + }; + + /** + * Encodes the specified VoiceSelectionParams message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams} message VoiceSelectionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoiceSelectionParams.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.ssmlGender != null && Object.hasOwnProperty.call(message, "ssmlGender")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ssmlGender); + return writer; + }; + + /** + * Encodes the specified VoiceSelectionParams message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams} message VoiceSelectionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoiceSelectionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @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.VoiceSelectionParams} VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoiceSelectionParams.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.VoiceSelectionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.ssmlGender = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams} VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoiceSelectionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VoiceSelectionParams message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VoiceSelectionParams.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.ssmlGender != null && message.hasOwnProperty("ssmlGender")) + switch (message.ssmlGender) { + default: + return "ssmlGender: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a VoiceSelectionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams} VoiceSelectionParams + */ + VoiceSelectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams(); + if (object.name != null) + message.name = String(object.name); + switch (object.ssmlGender) { + case "SSML_VOICE_GENDER_UNSPECIFIED": + case 0: + message.ssmlGender = 0; + break; + case "SSML_VOICE_GENDER_MALE": + case 1: + message.ssmlGender = 1; + break; + case "SSML_VOICE_GENDER_FEMALE": + case 2: + message.ssmlGender = 2; + break; + case "SSML_VOICE_GENDER_NEUTRAL": + case 3: + message.ssmlGender = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a VoiceSelectionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams} message VoiceSelectionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VoiceSelectionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.ssmlGender = options.enums === String ? "SSML_VOICE_GENDER_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.ssmlGender != null && message.hasOwnProperty("ssmlGender")) + object.ssmlGender = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender[message.ssmlGender] : message.ssmlGender; + return object; + }; + + /** + * Converts this VoiceSelectionParams to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams + * @instance + * @returns {Object.} JSON object + */ + VoiceSelectionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VoiceSelectionParams; + })(); + + v3beta1.SynthesizeSpeechConfig = (function() { + + /** + * Properties of a SynthesizeSpeechConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ISynthesizeSpeechConfig + * @property {number|null} [speakingRate] SynthesizeSpeechConfig speakingRate + * @property {number|null} [pitch] SynthesizeSpeechConfig pitch + * @property {number|null} [volumeGainDb] SynthesizeSpeechConfig volumeGainDb + * @property {Array.|null} [effectsProfileId] SynthesizeSpeechConfig effectsProfileId + * @property {google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams|null} [voice] SynthesizeSpeechConfig voice + */ + + /** + * Constructs a new SynthesizeSpeechConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SynthesizeSpeechConfig. + * @implements ISynthesizeSpeechConfig + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig=} [properties] Properties to set + */ + function SynthesizeSpeechConfig(properties) { + this.effectsProfileId = []; + 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]]; + } + + /** + * SynthesizeSpeechConfig speakingRate. + * @member {number} speakingRate + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.speakingRate = 0; + + /** + * SynthesizeSpeechConfig pitch. + * @member {number} pitch + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.pitch = 0; + + /** + * SynthesizeSpeechConfig volumeGainDb. + * @member {number} volumeGainDb + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.volumeGainDb = 0; + + /** + * SynthesizeSpeechConfig effectsProfileId. + * @member {Array.} effectsProfileId + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.effectsProfileId = $util.emptyArray; + + /** + * SynthesizeSpeechConfig voice. + * @member {google.cloud.dialogflow.cx.v3beta1.IVoiceSelectionParams|null|undefined} voice + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.voice = null; + + /** + * Creates a new SynthesizeSpeechConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig instance + */ + SynthesizeSpeechConfig.create = function create(properties) { + return new SynthesizeSpeechConfig(properties); + }; + + /** + * Encodes the specified SynthesizeSpeechConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig} message SynthesizeSpeechConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SynthesizeSpeechConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.speakingRate != null && Object.hasOwnProperty.call(message, "speakingRate")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.speakingRate); + if (message.pitch != null && Object.hasOwnProperty.call(message, "pitch")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.pitch); + if (message.volumeGainDb != null && Object.hasOwnProperty.call(message, "volumeGainDb")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.volumeGainDb); + if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) + $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.encode(message.voice, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.effectsProfileId != null && message.effectsProfileId.length) + for (var i = 0; i < message.effectsProfileId.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.effectsProfileId[i]); + return writer; + }; + + /** + * Encodes the specified SynthesizeSpeechConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig} message SynthesizeSpeechConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SynthesizeSpeechConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @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.SynthesizeSpeechConfig} SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SynthesizeSpeechConfig.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.SynthesizeSpeechConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.speakingRate = reader.double(); + break; + case 2: + message.pitch = reader.double(); + break; + case 3: + message.volumeGainDb = reader.double(); + break; + case 5: + if (!(message.effectsProfileId && message.effectsProfileId.length)) + message.effectsProfileId = []; + message.effectsProfileId.push(reader.string()); + break; + case 4: + message.voice = $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SynthesizeSpeechConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SynthesizeSpeechConfig message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SynthesizeSpeechConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.speakingRate != null && message.hasOwnProperty("speakingRate")) + if (typeof message.speakingRate !== "number") + return "speakingRate: number expected"; + if (message.pitch != null && message.hasOwnProperty("pitch")) + if (typeof message.pitch !== "number") + return "pitch: number expected"; + if (message.volumeGainDb != null && message.hasOwnProperty("volumeGainDb")) + if (typeof message.volumeGainDb !== "number") + return "volumeGainDb: number expected"; + if (message.effectsProfileId != null && message.hasOwnProperty("effectsProfileId")) { + if (!Array.isArray(message.effectsProfileId)) + return "effectsProfileId: array expected"; + for (var i = 0; i < message.effectsProfileId.length; ++i) + if (!$util.isString(message.effectsProfileId[i])) + return "effectsProfileId: string[] expected"; + } + if (message.voice != null && message.hasOwnProperty("voice")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.verify(message.voice); + if (error) + return "voice." + error; + } + return null; + }; + + /** + * Creates a SynthesizeSpeechConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig + */ + SynthesizeSpeechConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig(); + if (object.speakingRate != null) + message.speakingRate = Number(object.speakingRate); + if (object.pitch != null) + message.pitch = Number(object.pitch); + if (object.volumeGainDb != null) + message.volumeGainDb = Number(object.volumeGainDb); + if (object.effectsProfileId) { + if (!Array.isArray(object.effectsProfileId)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.effectsProfileId: array expected"); + message.effectsProfileId = []; + for (var i = 0; i < object.effectsProfileId.length; ++i) + message.effectsProfileId[i] = String(object.effectsProfileId[i]); + } + if (object.voice != null) { + if (typeof object.voice !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.voice: object expected"); + message.voice = $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.fromObject(object.voice); + } + return message; + }; + + /** + * Creates a plain object from a SynthesizeSpeechConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig} message SynthesizeSpeechConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SynthesizeSpeechConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.effectsProfileId = []; + if (options.defaults) { + object.speakingRate = 0; + object.pitch = 0; + object.volumeGainDb = 0; + object.voice = null; + } + if (message.speakingRate != null && message.hasOwnProperty("speakingRate")) + object.speakingRate = options.json && !isFinite(message.speakingRate) ? String(message.speakingRate) : message.speakingRate; + if (message.pitch != null && message.hasOwnProperty("pitch")) + object.pitch = options.json && !isFinite(message.pitch) ? String(message.pitch) : message.pitch; + if (message.volumeGainDb != null && message.hasOwnProperty("volumeGainDb")) + object.volumeGainDb = options.json && !isFinite(message.volumeGainDb) ? String(message.volumeGainDb) : message.volumeGainDb; + if (message.voice != null && message.hasOwnProperty("voice")) + object.voice = $root.google.cloud.dialogflow.cx.v3beta1.VoiceSelectionParams.toObject(message.voice, options); + if (message.effectsProfileId && message.effectsProfileId.length) { + object.effectsProfileId = []; + for (var j = 0; j < message.effectsProfileId.length; ++j) + object.effectsProfileId[j] = message.effectsProfileId[j]; + } + return object; + }; + + /** + * Converts this SynthesizeSpeechConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig + * @instance + * @returns {Object.} JSON object + */ + SynthesizeSpeechConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SynthesizeSpeechConfig; + })(); + + /** + * SsmlVoiceGender enum. + * @name google.cloud.dialogflow.cx.v3beta1.SsmlVoiceGender + * @enum {number} + * @property {number} SSML_VOICE_GENDER_UNSPECIFIED=0 SSML_VOICE_GENDER_UNSPECIFIED value + * @property {number} SSML_VOICE_GENDER_MALE=1 SSML_VOICE_GENDER_MALE value + * @property {number} SSML_VOICE_GENDER_FEMALE=2 SSML_VOICE_GENDER_FEMALE value + * @property {number} SSML_VOICE_GENDER_NEUTRAL=3 SSML_VOICE_GENDER_NEUTRAL value + */ + v3beta1.SsmlVoiceGender = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSML_VOICE_GENDER_UNSPECIFIED"] = 0; + values[valuesById[1] = "SSML_VOICE_GENDER_MALE"] = 1; + values[valuesById[2] = "SSML_VOICE_GENDER_FEMALE"] = 2; + values[valuesById[3] = "SSML_VOICE_GENDER_NEUTRAL"] = 3; + return values; + })(); + + v3beta1.OutputAudioConfig = (function() { + + /** + * Properties of an OutputAudioConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IOutputAudioConfig + * @property {google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding|null} [audioEncoding] OutputAudioConfig audioEncoding + * @property {number|null} [sampleRateHertz] OutputAudioConfig sampleRateHertz + * @property {google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig|null} [synthesizeSpeechConfig] OutputAudioConfig synthesizeSpeechConfig + */ + + /** + * Constructs a new OutputAudioConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an OutputAudioConfig. + * @implements IOutputAudioConfig + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig=} [properties] Properties to set + */ + function OutputAudioConfig(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]]; + } + + /** + * OutputAudioConfig audioEncoding. + * @member {google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding} audioEncoding + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.audioEncoding = 0; + + /** + * OutputAudioConfig sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.sampleRateHertz = 0; + + /** + * OutputAudioConfig synthesizeSpeechConfig. + * @member {google.cloud.dialogflow.cx.v3beta1.ISynthesizeSpeechConfig|null|undefined} synthesizeSpeechConfig + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.synthesizeSpeechConfig = null; + + /** + * Creates a new OutputAudioConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig} OutputAudioConfig instance + */ + OutputAudioConfig.create = function create(properties) { + return new OutputAudioConfig(properties); + }; + + /** + * Encodes the specified OutputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig} message OutputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioEncoding != null && Object.hasOwnProperty.call(message, "audioEncoding")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.audioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sampleRateHertz); + if (message.synthesizeSpeechConfig != null && Object.hasOwnProperty.call(message, "synthesizeSpeechConfig")) + $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.encode(message.synthesizeSpeechConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig} message OutputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @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.OutputAudioConfig} OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioConfig.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.OutputAudioConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.audioEncoding = reader.int32(); + break; + case 2: + message.sampleRateHertz = reader.int32(); + break; + case 3: + message.synthesizeSpeechConfig = $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig} OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputAudioConfig message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputAudioConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + switch (message.audioEncoding) { + default: + return "audioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 3: + case 5: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.synthesizeSpeechConfig != null && message.hasOwnProperty("synthesizeSpeechConfig")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.verify(message.synthesizeSpeechConfig); + if (error) + return "synthesizeSpeechConfig." + error; + } + return null; + }; + + /** + * Creates an OutputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig} OutputAudioConfig + */ + OutputAudioConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig(); + switch (object.audioEncoding) { + case "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.audioEncoding = 0; + break; + case "OUTPUT_AUDIO_ENCODING_LINEAR_16": + case 1: + message.audioEncoding = 1; + break; + case "OUTPUT_AUDIO_ENCODING_MP3": + case 2: + message.audioEncoding = 2; + break; + case "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": + case 4: + message.audioEncoding = 4; + break; + case "OUTPUT_AUDIO_ENCODING_OGG_OPUS": + case 3: + message.audioEncoding = 3; + break; + case "OUTPUT_AUDIO_ENCODING_MULAW": + case 5: + message.audioEncoding = 5; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.synthesizeSpeechConfig != null) { + if (typeof object.synthesizeSpeechConfig !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.synthesizeSpeechConfig: object expected"); + message.synthesizeSpeechConfig = $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.fromObject(object.synthesizeSpeechConfig); + } + return message; + }; + + /** + * Creates a plain object from an OutputAudioConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig} message OutputAudioConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputAudioConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.audioEncoding = options.enums === String ? "OUTPUT_AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + object.synthesizeSpeechConfig = null; + } + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + object.audioEncoding = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding[message.audioEncoding] : message.audioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + if (message.synthesizeSpeechConfig != null && message.hasOwnProperty("synthesizeSpeechConfig")) + object.synthesizeSpeechConfig = $root.google.cloud.dialogflow.cx.v3beta1.SynthesizeSpeechConfig.toObject(message.synthesizeSpeechConfig, options); + return object; + }; + + /** + * Converts this OutputAudioConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig + * @instance + * @returns {Object.} JSON object + */ + OutputAudioConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OutputAudioConfig; + })(); + + /** + * OutputAudioEncoding enum. + * @name google.cloud.dialogflow.cx.v3beta1.OutputAudioEncoding + * @enum {number} + * @property {number} OUTPUT_AUDIO_ENCODING_UNSPECIFIED=0 OUTPUT_AUDIO_ENCODING_UNSPECIFIED value + * @property {number} OUTPUT_AUDIO_ENCODING_LINEAR_16=1 OUTPUT_AUDIO_ENCODING_LINEAR_16 value + * @property {number} OUTPUT_AUDIO_ENCODING_MP3=2 OUTPUT_AUDIO_ENCODING_MP3 value + * @property {number} OUTPUT_AUDIO_ENCODING_MP3_64_KBPS=4 OUTPUT_AUDIO_ENCODING_MP3_64_KBPS value + * @property {number} OUTPUT_AUDIO_ENCODING_OGG_OPUS=3 OUTPUT_AUDIO_ENCODING_OGG_OPUS value + * @property {number} OUTPUT_AUDIO_ENCODING_MULAW=5 OUTPUT_AUDIO_ENCODING_MULAW value + */ + v3beta1.OutputAudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OUTPUT_AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "OUTPUT_AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "OUTPUT_AUDIO_ENCODING_MP3"] = 2; + values[valuesById[4] = "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS"] = 4; + values[valuesById[3] = "OUTPUT_AUDIO_ENCODING_OGG_OPUS"] = 3; + values[valuesById[5] = "OUTPUT_AUDIO_ENCODING_MULAW"] = 5; + return values; + })(); + + v3beta1.EntityTypes = (function() { + + /** + * Constructs a new EntityTypes service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an EntityTypes + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function EntityTypes(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (EntityTypes.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = EntityTypes; + + /** + * Creates new EntityTypes service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {EntityTypes} RPC service. Useful where requests and/or responses are streamed. + */ + EntityTypes.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#listEntityTypes}. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @typedef ListEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse} [response] ListEntityTypesResponse + */ + + /** + * Calls ListEntityTypes. + * @function listEntityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest} request ListEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.EntityTypes.ListEntityTypesCallback} callback Node-style callback called with the error, if any, and ListEntityTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.listEntityTypes = function listEntityTypes(request, callback) { + return this.rpcCall(listEntityTypes, $root.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse, request, callback); + }, "name", { value: "ListEntityTypes" }); + + /** + * Calls ListEntityTypes. + * @function listEntityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest} request ListEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#getEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @typedef GetEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType} [response] EntityType + */ + + /** + * Calls GetEntityType. + * @function getEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest} request GetEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.EntityTypes.GetEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.getEntityType = function getEntityType(request, callback) { + return this.rpcCall(getEntityType, $root.google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest, $root.google.cloud.dialogflow.cx.v3beta1.EntityType, request, callback); + }, "name", { value: "GetEntityType" }); + + /** + * Calls GetEntityType. + * @function getEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest} request GetEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#createEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @typedef CreateEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType} [response] EntityType + */ + + /** + * Calls CreateEntityType. + * @function createEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest} request CreateEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.EntityTypes.CreateEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.createEntityType = function createEntityType(request, callback) { + return this.rpcCall(createEntityType, $root.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest, $root.google.cloud.dialogflow.cx.v3beta1.EntityType, request, callback); + }, "name", { value: "CreateEntityType" }); + + /** + * Calls CreateEntityType. + * @function createEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest} request CreateEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#updateEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @typedef UpdateEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType} [response] EntityType + */ + + /** + * Calls UpdateEntityType. + * @function updateEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest} request UpdateEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.EntityTypes.UpdateEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.updateEntityType = function updateEntityType(request, callback) { + return this.rpcCall(updateEntityType, $root.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest, $root.google.cloud.dialogflow.cx.v3beta1.EntityType, request, callback); + }, "name", { value: "UpdateEntityType" }); + + /** + * Calls UpdateEntityType. + * @function updateEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest} request UpdateEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.EntityTypes#deleteEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @typedef DeleteEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteEntityType. + * @function deleteEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest} request DeleteEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.EntityTypes.DeleteEntityTypeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.deleteEntityType = function deleteEntityType(request, callback) { + return this.rpcCall(deleteEntityType, $root.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteEntityType" }); + + /** + * Calls DeleteEntityType. + * @function deleteEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest} request DeleteEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return EntityTypes; + })(); + + v3beta1.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IEntityType + * @property {string|null} [name] EntityType name + * @property {string|null} [displayName] EntityType displayName + * @property {google.cloud.dialogflow.cx.v3beta1.EntityType.Kind|null} [kind] EntityType kind + * @property {google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode|null} [autoExpansionMode] EntityType autoExpansionMode + * @property {Array.|null} [entities] EntityType entities + * @property {Array.|null} [excludedPhrases] EntityType excludedPhrases + * @property {boolean|null} [enableFuzzyExtraction] EntityType enableFuzzyExtraction + */ + + /** + * Constructs a new EntityType. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IEntityType=} [properties] Properties to set + */ + function EntityType(properties) { + this.entities = []; + this.excludedPhrases = []; + 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]]; + } + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType kind. + * @member {google.cloud.dialogflow.cx.v3beta1.EntityType.Kind} kind + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.kind = 0; + + /** + * EntityType autoExpansionMode. + * @member {google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode} autoExpansionMode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.autoExpansionMode = 0; + + /** + * EntityType entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.entities = $util.emptyArray; + + /** + * EntityType excludedPhrases. + * @member {Array.} excludedPhrases + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.excludedPhrases = $util.emptyArray; + + /** + * EntityType enableFuzzyExtraction. + * @member {boolean} enableFuzzyExtraction + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + */ + EntityType.prototype.enableFuzzyExtraction = false; + + /** + * Creates a new EntityType instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEntityType=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType} EntityType instance + */ + EntityType.create = function create(properties) { + return new EntityType(properties); + }; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.kind); + if (message.autoExpansionMode != null && Object.hasOwnProperty.call(message, "autoExpansionMode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.autoExpansionMode); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.excludedPhrases != null && message.excludedPhrases.length) + for (var i = 0; i < message.excludedPhrases.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.encode(message.excludedPhrases[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.enableFuzzyExtraction != null && Object.hasOwnProperty.call(message, "enableFuzzyExtraction")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFuzzyExtraction); + return writer; + }; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @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.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.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.EntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.kind = reader.int32(); + break; + case 4: + message.autoExpansionMode = reader.int32(); + break; + case 5: + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.excludedPhrases && message.excludedPhrases.length)) + message.excludedPhrases = []; + message.excludedPhrases.push($root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.decode(reader, reader.uint32())); + break; + case 7: + message.enableFuzzyExtraction = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityType message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityType.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + switch (message.kind) { + default: + return "kind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.autoExpansionMode != null && message.hasOwnProperty("autoExpansionMode")) + switch (message.autoExpansionMode) { + default: + return "autoExpansionMode: enum value expected"; + case 0: + case 1: + break; + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.excludedPhrases != null && message.hasOwnProperty("excludedPhrases")) { + if (!Array.isArray(message.excludedPhrases)) + return "excludedPhrases: array expected"; + for (var i = 0; i < message.excludedPhrases.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.verify(message.excludedPhrases[i]); + if (error) + return "excludedPhrases." + error; + } + } + if (message.enableFuzzyExtraction != null && message.hasOwnProperty("enableFuzzyExtraction")) + if (typeof message.enableFuzzyExtraction !== "boolean") + return "enableFuzzyExtraction: boolean expected"; + return null; + }; + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.EntityType) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.EntityType(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.kind) { + case "KIND_UNSPECIFIED": + case 0: + message.kind = 0; + break; + case "KIND_MAP": + case 1: + message.kind = 1; + break; + case "KIND_LIST": + case 2: + message.kind = 2; + break; + case "KIND_REGEXP": + case 3: + message.kind = 3; + break; + } + switch (object.autoExpansionMode) { + case "AUTO_EXPANSION_MODE_UNSPECIFIED": + case 0: + message.autoExpansionMode = 0; + break; + case "AUTO_EXPANSION_MODE_DEFAULT": + case 1: + message.autoExpansionMode = 1; + break; + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.EntityType.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.EntityType.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.excludedPhrases) { + if (!Array.isArray(object.excludedPhrases)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.EntityType.excludedPhrases: array expected"); + message.excludedPhrases = []; + for (var i = 0; i < object.excludedPhrases.length; ++i) { + if (typeof object.excludedPhrases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.EntityType.excludedPhrases: object expected"); + message.excludedPhrases[i] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.fromObject(object.excludedPhrases[i]); + } + } + if (object.enableFuzzyExtraction != null) + message.enableFuzzyExtraction = Boolean(object.enableFuzzyExtraction); + return message; + }; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType} message EntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.entities = []; + object.excludedPhrases = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.kind = options.enums === String ? "KIND_UNSPECIFIED" : 0; + object.autoExpansionMode = options.enums === String ? "AUTO_EXPANSION_MODE_UNSPECIFIED" : 0; + object.enableFuzzyExtraction = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Kind[message.kind] : message.kind; + if (message.autoExpansionMode != null && message.hasOwnProperty("autoExpansionMode")) + object.autoExpansionMode = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode[message.autoExpansionMode] : message.autoExpansionMode; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.excludedPhrases && message.excludedPhrases.length) { + object.excludedPhrases = []; + for (var j = 0; j < message.excludedPhrases.length; ++j) + object.excludedPhrases[j] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.toObject(message.excludedPhrases[j], options); + } + if (message.enableFuzzyExtraction != null && message.hasOwnProperty("enableFuzzyExtraction")) + object.enableFuzzyExtraction = message.enableFuzzyExtraction; + return object; + }; + + /** + * Converts this EntityType to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EntityType.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @interface IEntity + * @property {string|null} [value] Entity value + * @property {Array.|null} [synonyms] Entity synonyms + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + this.synonyms = []; + 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]]; + } + + /** + * Entity value. + * @member {string} value + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @instance + */ + Entity.prototype.value = ""; + + /** + * Entity synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @instance + */ + Entity.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @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.EntityType.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.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.EntityType.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + case 2: + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity(); + if (object.value != null) + message.value = String(object.value); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Entity; + })(); + + EntityType.ExcludedPhrase = (function() { + + /** + * Properties of an ExcludedPhrase. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @interface IExcludedPhrase + * @property {string|null} [value] ExcludedPhrase value + */ + + /** + * Constructs a new ExcludedPhrase. + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType + * @classdesc Represents an ExcludedPhrase. + * @implements IExcludedPhrase + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase=} [properties] Properties to set + */ + function ExcludedPhrase(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]]; + } + + /** + * ExcludedPhrase value. + * @member {string} value + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @instance + */ + ExcludedPhrase.prototype.value = ""; + + /** + * Creates a new ExcludedPhrase instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase} ExcludedPhrase instance + */ + ExcludedPhrase.create = function create(properties) { + return new ExcludedPhrase(properties); + }; + + /** + * Encodes the specified ExcludedPhrase message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase} message ExcludedPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExcludedPhrase.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified ExcludedPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.IExcludedPhrase} message ExcludedPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExcludedPhrase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExcludedPhrase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @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.EntityType.ExcludedPhrase} ExcludedPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExcludedPhrase.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.EntityType.ExcludedPhrase(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExcludedPhrase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase} ExcludedPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExcludedPhrase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExcludedPhrase message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExcludedPhrase.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an ExcludedPhrase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase} ExcludedPhrase + */ + ExcludedPhrase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an ExcludedPhrase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase} message ExcludedPhrase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExcludedPhrase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this ExcludedPhrase to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.EntityType.ExcludedPhrase + * @instance + * @returns {Object.} JSON object + */ + ExcludedPhrase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExcludedPhrase; + })(); + + /** + * Kind enum. + * @name google.cloud.dialogflow.cx.v3beta1.EntityType.Kind + * @enum {number} + * @property {number} KIND_UNSPECIFIED=0 KIND_UNSPECIFIED value + * @property {number} KIND_MAP=1 KIND_MAP value + * @property {number} KIND_LIST=2 KIND_LIST value + * @property {number} KIND_REGEXP=3 KIND_REGEXP value + */ + EntityType.Kind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "KIND_MAP"] = 1; + values[valuesById[2] = "KIND_LIST"] = 2; + values[valuesById[3] = "KIND_REGEXP"] = 3; + return values; + })(); + + /** + * AutoExpansionMode enum. + * @name google.cloud.dialogflow.cx.v3beta1.EntityType.AutoExpansionMode + * @enum {number} + * @property {number} AUTO_EXPANSION_MODE_UNSPECIFIED=0 AUTO_EXPANSION_MODE_UNSPECIFIED value + * @property {number} AUTO_EXPANSION_MODE_DEFAULT=1 AUTO_EXPANSION_MODE_DEFAULT value + */ + EntityType.AutoExpansionMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTO_EXPANSION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO_EXPANSION_MODE_DEFAULT"] = 1; + return values; + })(); + + return EntityType; + })(); + + v3beta1.ListEntityTypesRequest = (function() { + + /** + * Properties of a ListEntityTypesRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListEntityTypesRequest + * @property {string|null} [parent] ListEntityTypesRequest parent + * @property {string|null} [languageCode] ListEntityTypesRequest languageCode + * @property {number|null} [pageSize] ListEntityTypesRequest pageSize + * @property {string|null} [pageToken] ListEntityTypesRequest pageToken + */ + + /** + * Constructs a new ListEntityTypesRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListEntityTypesRequest. + * @implements IListEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest=} [properties] Properties to set + */ + function ListEntityTypesRequest(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]]; + } + + /** + * ListEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.parent = ""; + + /** + * ListEntityTypesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.languageCode = ""; + + /** + * ListEntityTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.pageSize = 0; + + /** + * ListEntityTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest} ListEntityTypesRequest instance + */ + ListEntityTypesRequest.create = function create(properties) { + return new ListEntityTypesRequest(properties); + }; + + /** + * Encodes the specified ListEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest} message ListEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest} message ListEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @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.ListEntityTypesRequest} ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesRequest.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.ListEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest} ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEntityTypesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest} ListEntityTypesRequest + */ + ListEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest} message ListEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListEntityTypesRequest; + })(); + + v3beta1.ListEntityTypesResponse = (function() { + + /** + * Properties of a ListEntityTypesResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListEntityTypesResponse + * @property {Array.|null} [entityTypes] ListEntityTypesResponse entityTypes + * @property {string|null} [nextPageToken] ListEntityTypesResponse nextPageToken + */ + + /** + * Constructs a new ListEntityTypesResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListEntityTypesResponse. + * @implements IListEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse=} [properties] Properties to set + */ + function ListEntityTypesResponse(properties) { + this.entityTypes = []; + 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]]; + } + + /** + * ListEntityTypesResponse entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @instance + */ + ListEntityTypesResponse.prototype.entityTypes = $util.emptyArray; + + /** + * ListEntityTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @instance + */ + ListEntityTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse} ListEntityTypesResponse instance + */ + ListEntityTypesResponse.create = function create(properties) { + return new ListEntityTypesResponse(properties); + }; + + /** + * Encodes the specified ListEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse} message ListEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse} message ListEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @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.ListEntityTypesResponse} ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesResponse.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.ListEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.cx.v3beta1.EntityType.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse} ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse} ListEntityTypesResponse + */ + ListEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse} message ListEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.toObject(message.entityTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListEntityTypesResponse; + })(); + + v3beta1.GetEntityTypeRequest = (function() { + + /** + * Properties of a GetEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetEntityTypeRequest + * @property {string|null} [name] GetEntityTypeRequest name + * @property {string|null} [languageCode] GetEntityTypeRequest languageCode + */ + + /** + * Constructs a new GetEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetEntityTypeRequest. + * @implements IGetEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest=} [properties] Properties to set + */ + function GetEntityTypeRequest(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]]; + } + + /** + * GetEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @instance + */ + GetEntityTypeRequest.prototype.name = ""; + + /** + * GetEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @instance + */ + GetEntityTypeRequest.prototype.languageCode = ""; + + /** + * Creates a new GetEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest} GetEntityTypeRequest instance + */ + GetEntityTypeRequest.create = function create(properties) { + return new GetEntityTypeRequest(properties); + }; + + /** + * Encodes the specified GetEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest} message GetEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEntityTypeRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest} message GetEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @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.GetEntityTypeRequest} GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEntityTypeRequest.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.GetEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest} GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEntityTypeRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest} GetEntityTypeRequest + */ + GetEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest} message GetEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetEntityTypeRequest; + })(); + + v3beta1.CreateEntityTypeRequest = (function() { + + /** + * Properties of a CreateEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateEntityTypeRequest + * @property {string|null} [parent] CreateEntityTypeRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IEntityType|null} [entityType] CreateEntityTypeRequest entityType + * @property {string|null} [languageCode] CreateEntityTypeRequest languageCode + */ + + /** + * Constructs a new CreateEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateEntityTypeRequest. + * @implements ICreateEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest=} [properties] Properties to set + */ + function CreateEntityTypeRequest(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]]; + } + + /** + * CreateEntityTypeRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.parent = ""; + + /** + * CreateEntityTypeRequest entityType. + * @member {google.cloud.dialogflow.cx.v3beta1.IEntityType|null|undefined} entityType + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.entityType = null; + + /** + * CreateEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.languageCode = ""; + + /** + * Creates a new CreateEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest} CreateEntityTypeRequest instance + */ + CreateEntityTypeRequest.create = function create(properties) { + return new CreateEntityTypeRequest(properties); + }; + + /** + * Encodes the specified CreateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest} message CreateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEntityTypeRequest.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.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + $root.google.cloud.dialogflow.cx.v3beta1.EntityType.encode(message.entityType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest} message CreateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @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.CreateEntityTypeRequest} CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEntityTypeRequest.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.CreateEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.entityType = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest} CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.verify(message.entityType); + if (error) + return "entityType." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest} CreateEntityTypeRequest + */ + CreateEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityType != null) { + if (typeof object.entityType !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest.entityType: object expected"); + message.entityType = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.fromObject(object.entityType); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreateEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest} message CreateEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.entityType = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.toObject(message.entityType, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreateEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateEntityTypeRequest; + })(); + + v3beta1.UpdateEntityTypeRequest = (function() { + + /** + * Properties of an UpdateEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateEntityTypeRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IEntityType|null} [entityType] UpdateEntityTypeRequest entityType + * @property {string|null} [languageCode] UpdateEntityTypeRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEntityTypeRequest updateMask + */ + + /** + * Constructs a new UpdateEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateEntityTypeRequest. + * @implements IUpdateEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest=} [properties] Properties to set + */ + function UpdateEntityTypeRequest(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]]; + } + + /** + * UpdateEntityTypeRequest entityType. + * @member {google.cloud.dialogflow.cx.v3beta1.IEntityType|null|undefined} entityType + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.entityType = null; + + /** + * UpdateEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.languageCode = ""; + + /** + * UpdateEntityTypeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest instance + */ + UpdateEntityTypeRequest.create = function create(properties) { + return new UpdateEntityTypeRequest(properties); + }; + + /** + * Encodes the specified UpdateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest} message UpdateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEntityTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + $root.google.cloud.dialogflow.cx.v3beta1.EntityType.encode(message.entityType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest} message UpdateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @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.UpdateEntityTypeRequest} UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEntityTypeRequest.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.UpdateEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entityType = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.decode(reader, reader.uint32()); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.verify(message.entityType); + if (error) + return "entityType." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest + */ + UpdateEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest(); + if (object.entityType != null) { + if (typeof object.entityType !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest.entityType: object expected"); + message.entityType = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.fromObject(object.entityType); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest} message UpdateEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.entityType = null; + object.languageCode = ""; + object.updateMask = null; + } + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.toObject(message.entityType, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateEntityTypeRequest; + })(); + + v3beta1.DeleteEntityTypeRequest = (function() { + + /** + * Properties of a DeleteEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteEntityTypeRequest + * @property {string|null} [name] DeleteEntityTypeRequest name + * @property {boolean|null} [force] DeleteEntityTypeRequest force + */ + + /** + * Constructs a new DeleteEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteEntityTypeRequest. + * @implements IDeleteEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest=} [properties] Properties to set + */ + function DeleteEntityTypeRequest(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]]; + } + + /** + * DeleteEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @instance + */ + DeleteEntityTypeRequest.prototype.name = ""; + + /** + * DeleteEntityTypeRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @instance + */ + DeleteEntityTypeRequest.prototype.force = false; + + /** + * Creates a new DeleteEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest instance + */ + DeleteEntityTypeRequest.create = function create(properties) { + return new DeleteEntityTypeRequest(properties); + }; + + /** + * Encodes the specified DeleteEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest} message DeleteEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEntityTypeRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest} message DeleteEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @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.DeleteEntityTypeRequest} DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEntityTypeRequest.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.DeleteEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteEntityTypeRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest + */ + DeleteEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest} message DeleteEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteEntityTypeRequest; + })(); + + v3beta1.Environments = (function() { + + /** + * Constructs a new Environments service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an Environments + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Environments(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Environments.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Environments; + + /** + * Creates new Environments service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Environments} RPC service. Useful where requests and/or responses are streamed. + */ + Environments.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#listEnvironments}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @typedef ListEnvironmentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse} [response] ListEnvironmentsResponse + */ + + /** + * Calls ListEnvironments. + * @function listEnvironments + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest} request ListEnvironmentsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Environments.ListEnvironmentsCallback} callback Node-style callback called with the error, if any, and ListEnvironmentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.listEnvironments = function listEnvironments(request, callback) { + return this.rpcCall(listEnvironments, $root.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse, request, callback); + }, "name", { value: "ListEnvironments" }); + + /** + * Calls ListEnvironments. + * @function listEnvironments + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest} request ListEnvironmentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#getEnvironment}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @typedef GetEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Environment} [response] Environment + */ + + /** + * Calls GetEnvironment. + * @function getEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest} request GetEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Environments.GetEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.getEnvironment = function getEnvironment(request, callback) { + return this.rpcCall(getEnvironment, $root.google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Environment, request, callback); + }, "name", { value: "GetEnvironment" }); + + /** + * Calls GetEnvironment. + * @function getEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest} request GetEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#createEnvironment}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @typedef CreateEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateEnvironment. + * @function createEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest} request CreateEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Environments.CreateEnvironmentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.createEnvironment = function createEnvironment(request, callback) { + return this.rpcCall(createEnvironment, $root.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateEnvironment" }); + + /** + * Calls CreateEnvironment. + * @function createEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest} request CreateEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#updateEnvironment}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @typedef UpdateEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateEnvironment. + * @function updateEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest} request UpdateEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Environments.UpdateEnvironmentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.updateEnvironment = function updateEnvironment(request, callback) { + return this.rpcCall(updateEnvironment, $root.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateEnvironment" }); + + /** + * Calls UpdateEnvironment. + * @function updateEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest} request UpdateEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#deleteEnvironment}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @typedef DeleteEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteEnvironment. + * @function deleteEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest} request DeleteEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Environments.DeleteEnvironmentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.deleteEnvironment = function deleteEnvironment(request, callback) { + return this.rpcCall(deleteEnvironment, $root.google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteEnvironment" }); + + /** + * Calls DeleteEnvironment. + * @function deleteEnvironment + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest} request DeleteEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Environments#lookupEnvironmentHistory}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @typedef LookupEnvironmentHistoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse} [response] LookupEnvironmentHistoryResponse + */ + + /** + * Calls LookupEnvironmentHistory. + * @function lookupEnvironmentHistory + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest} request LookupEnvironmentHistoryRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Environments.LookupEnvironmentHistoryCallback} callback Node-style callback called with the error, if any, and LookupEnvironmentHistoryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.lookupEnvironmentHistory = function lookupEnvironmentHistory(request, callback) { + return this.rpcCall(lookupEnvironmentHistory, $root.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest, $root.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse, request, callback); + }, "name", { value: "LookupEnvironmentHistory" }); + + /** + * Calls LookupEnvironmentHistory. + * @function lookupEnvironmentHistory + * @memberof google.cloud.dialogflow.cx.v3beta1.Environments + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest} request LookupEnvironmentHistoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Environments; + })(); + + v3beta1.Environment = (function() { + + /** + * Properties of an Environment. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IEnvironment + * @property {string|null} [name] Environment name + * @property {string|null} [displayName] Environment displayName + * @property {string|null} [description] Environment description + * @property {Array.|null} [versionConfigs] Environment versionConfigs + * @property {google.protobuf.ITimestamp|null} [updateTime] Environment updateTime + */ + + /** + * Constructs a new Environment. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an Environment. + * @implements IEnvironment + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IEnvironment=} [properties] Properties to set + */ + function Environment(properties) { + this.versionConfigs = []; + 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]]; + } + + /** + * Environment name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @instance + */ + Environment.prototype.name = ""; + + /** + * Environment displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @instance + */ + Environment.prototype.displayName = ""; + + /** + * Environment description. + * @member {string} description + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @instance + */ + Environment.prototype.description = ""; + + /** + * Environment versionConfigs. + * @member {Array.} versionConfigs + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @instance + */ + Environment.prototype.versionConfigs = $util.emptyArray; + + /** + * Environment updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @instance + */ + Environment.prototype.updateTime = null; + + /** + * Creates a new Environment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEnvironment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Environment} Environment instance + */ + Environment.create = function create(properties) { + return new Environment(properties); + }; + + /** + * Encodes the specified Environment message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEnvironment} message Environment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Environment.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.versionConfigs != null && message.versionConfigs.length) + for (var i = 0; i < message.versionConfigs.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.encode(message.versionConfigs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEnvironment} message Environment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Environment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Environment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @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.Environment} Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Environment.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.Environment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 6: + if (!(message.versionConfigs && message.versionConfigs.length)) + message.versionConfigs = []; + message.versionConfigs.push($root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.decode(reader, reader.uint32())); + break; + case 5: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Environment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Environment} Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Environment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Environment message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Environment.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.versionConfigs != null && message.hasOwnProperty("versionConfigs")) { + if (!Array.isArray(message.versionConfigs)) + return "versionConfigs: array expected"; + for (var i = 0; i < message.versionConfigs.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.verify(message.versionConfigs[i]); + if (error) + return "versionConfigs." + error; + } + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates an Environment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Environment} Environment + */ + Environment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Environment) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Environment(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.versionConfigs) { + if (!Array.isArray(object.versionConfigs)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Environment.versionConfigs: array expected"); + message.versionConfigs = []; + for (var i = 0; i < object.versionConfigs.length; ++i) { + if (typeof object.versionConfigs[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Environment.versionConfigs: object expected"); + message.versionConfigs[i] = $root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.fromObject(object.versionConfigs[i]); + } + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Environment.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from an Environment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Environment} message Environment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Environment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versionConfigs = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + object.updateTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.versionConfigs && message.versionConfigs.length) { + object.versionConfigs = []; + for (var j = 0; j < message.versionConfigs.length; ++j) + object.versionConfigs[j] = $root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.toObject(message.versionConfigs[j], options); + } + return object; + }; + + /** + * Converts this Environment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @instance + * @returns {Object.} JSON object + */ + Environment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Environment.VersionConfig = (function() { + + /** + * Properties of a VersionConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @interface IVersionConfig + * @property {string|null} [version] VersionConfig version + */ + + /** + * Constructs a new VersionConfig. + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment + * @classdesc Represents a VersionConfig. + * @implements IVersionConfig + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig=} [properties] Properties to set + */ + function VersionConfig(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]]; + } + + /** + * VersionConfig version. + * @member {string} version + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @instance + */ + VersionConfig.prototype.version = ""; + + /** + * Creates a new VersionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig} VersionConfig instance + */ + VersionConfig.create = function create(properties) { + return new VersionConfig(properties); + }; + + /** + * Encodes the specified VersionConfig message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig} message VersionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + return writer; + }; + + /** + * Encodes the specified VersionConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Environment.IVersionConfig} message VersionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VersionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VersionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @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.Environment.VersionConfig} VersionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionConfig.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.Environment.VersionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VersionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig} VersionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VersionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VersionConfig message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VersionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a VersionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig} VersionConfig + */ + VersionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig(); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a VersionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig} message VersionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VersionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.version = ""; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this VersionConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Environment.VersionConfig + * @instance + * @returns {Object.} JSON object + */ + VersionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return VersionConfig; + })(); + + return Environment; + })(); + + v3beta1.ListEnvironmentsRequest = (function() { + + /** + * Properties of a ListEnvironmentsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListEnvironmentsRequest + * @property {string|null} [parent] ListEnvironmentsRequest parent + * @property {number|null} [pageSize] ListEnvironmentsRequest pageSize + * @property {string|null} [pageToken] ListEnvironmentsRequest pageToken + */ + + /** + * Constructs a new ListEnvironmentsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListEnvironmentsRequest. + * @implements IListEnvironmentsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest=} [properties] Properties to set + */ + function ListEnvironmentsRequest(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]]; + } + + /** + * ListEnvironmentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.parent = ""; + + /** + * ListEnvironmentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.pageSize = 0; + + /** + * ListEnvironmentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEnvironmentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest} ListEnvironmentsRequest instance + */ + ListEnvironmentsRequest.create = function create(properties) { + return new ListEnvironmentsRequest(properties); + }; + + /** + * Encodes the specified ListEnvironmentsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest} message ListEnvironmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListEnvironmentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest} message ListEnvironmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @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.ListEnvironmentsRequest} ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsRequest.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.ListEnvironmentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest} ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEnvironmentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEnvironmentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListEnvironmentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest} ListEnvironmentsRequest + */ + ListEnvironmentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListEnvironmentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest} message ListEnvironmentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEnvironmentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListEnvironmentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListEnvironmentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListEnvironmentsRequest; + })(); + + v3beta1.ListEnvironmentsResponse = (function() { + + /** + * Properties of a ListEnvironmentsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListEnvironmentsResponse + * @property {Array.|null} [environments] ListEnvironmentsResponse environments + * @property {string|null} [nextPageToken] ListEnvironmentsResponse nextPageToken + */ + + /** + * Constructs a new ListEnvironmentsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListEnvironmentsResponse. + * @implements IListEnvironmentsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse=} [properties] Properties to set + */ + function ListEnvironmentsResponse(properties) { + this.environments = []; + 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]]; + } + + /** + * ListEnvironmentsResponse environments. + * @member {Array.} environments + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @instance + */ + ListEnvironmentsResponse.prototype.environments = $util.emptyArray; + + /** + * ListEnvironmentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @instance + */ + ListEnvironmentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEnvironmentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse} ListEnvironmentsResponse instance + */ + ListEnvironmentsResponse.create = function create(properties) { + return new ListEnvironmentsResponse(properties); + }; + + /** + * Encodes the specified ListEnvironmentsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse} message ListEnvironmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environments != null && message.environments.length) + for (var i = 0; i < message.environments.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Environment.encode(message.environments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListEnvironmentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse} message ListEnvironmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @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.ListEnvironmentsResponse} ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsResponse.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.ListEnvironmentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.environments && message.environments.length)) + message.environments = []; + message.environments.push($root.google.cloud.dialogflow.cx.v3beta1.Environment.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse} ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEnvironmentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEnvironmentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environments != null && message.hasOwnProperty("environments")) { + if (!Array.isArray(message.environments)) + return "environments: array expected"; + for (var i = 0; i < message.environments.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Environment.verify(message.environments[i]); + if (error) + return "environments." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEnvironmentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse} ListEnvironmentsResponse + */ + ListEnvironmentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse(); + if (object.environments) { + if (!Array.isArray(object.environments)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse.environments: array expected"); + message.environments = []; + for (var i = 0; i < object.environments.length; ++i) { + if (typeof object.environments[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse.environments: object expected"); + message.environments[i] = $root.google.cloud.dialogflow.cx.v3beta1.Environment.fromObject(object.environments[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEnvironmentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse} message ListEnvironmentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEnvironmentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.environments = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.environments && message.environments.length) { + object.environments = []; + for (var j = 0; j < message.environments.length; ++j) + object.environments[j] = $root.google.cloud.dialogflow.cx.v3beta1.Environment.toObject(message.environments[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEnvironmentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListEnvironmentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListEnvironmentsResponse; + })(); + + v3beta1.GetEnvironmentRequest = (function() { + + /** + * Properties of a GetEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetEnvironmentRequest + * @property {string|null} [name] GetEnvironmentRequest name + */ + + /** + * Constructs a new GetEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetEnvironmentRequest. + * @implements IGetEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest=} [properties] Properties to set + */ + function GetEnvironmentRequest(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]]; + } + + /** + * GetEnvironmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @instance + */ + GetEnvironmentRequest.prototype.name = ""; + + /** + * Creates a new GetEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest} GetEnvironmentRequest instance + */ + GetEnvironmentRequest.create = function create(properties) { + return new GetEnvironmentRequest(properties); + }; + + /** + * Encodes the specified GetEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest} message GetEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentRequest.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); + return writer; + }; + + /** + * Encodes the specified GetEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest} message GetEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @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.GetEnvironmentRequest} GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentRequest.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.GetEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest} GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEnvironmentRequest.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"; + return null; + }; + + /** + * Creates a GetEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest} GetEnvironmentRequest + */ + GetEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest} message GetEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + GetEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetEnvironmentRequest; + })(); + + v3beta1.CreateEnvironmentRequest = (function() { + + /** + * Properties of a CreateEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateEnvironmentRequest + * @property {string|null} [parent] CreateEnvironmentRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IEnvironment|null} [environment] CreateEnvironmentRequest environment + */ + + /** + * Constructs a new CreateEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateEnvironmentRequest. + * @implements ICreateEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest=} [properties] Properties to set + */ + function CreateEnvironmentRequest(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]]; + } + + /** + * CreateEnvironmentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.parent = ""; + + /** + * CreateEnvironmentRequest environment. + * @member {google.cloud.dialogflow.cx.v3beta1.IEnvironment|null|undefined} environment + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.environment = null; + + /** + * Creates a new CreateEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest} CreateEnvironmentRequest instance + */ + CreateEnvironmentRequest.create = function create(properties) { + return new CreateEnvironmentRequest(properties); + }; + + /** + * Encodes the specified CreateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest} message CreateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEnvironmentRequest.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.environment != null && Object.hasOwnProperty.call(message, "environment")) + $root.google.cloud.dialogflow.cx.v3beta1.Environment.encode(message.environment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest} message CreateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @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.CreateEnvironmentRequest} CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEnvironmentRequest.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.CreateEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.environment = $root.google.cloud.dialogflow.cx.v3beta1.Environment.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest} CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEnvironmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.environment != null && message.hasOwnProperty("environment")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Environment.verify(message.environment); + if (error) + return "environment." + error; + } + return null; + }; + + /** + * Creates a CreateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest} CreateEnvironmentRequest + */ + CreateEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.environment != null) { + if (typeof object.environment !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest.environment: object expected"); + message.environment = $root.google.cloud.dialogflow.cx.v3beta1.Environment.fromObject(object.environment); + } + return message; + }; + + /** + * Creates a plain object from a CreateEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest} message CreateEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.environment = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = $root.google.cloud.dialogflow.cx.v3beta1.Environment.toObject(message.environment, options); + return object; + }; + + /** + * Converts this CreateEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateEnvironmentRequest; + })(); + + v3beta1.UpdateEnvironmentRequest = (function() { + + /** + * Properties of an UpdateEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateEnvironmentRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IEnvironment|null} [environment] UpdateEnvironmentRequest environment + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEnvironmentRequest updateMask + */ + + /** + * Constructs a new UpdateEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateEnvironmentRequest. + * @implements IUpdateEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest=} [properties] Properties to set + */ + function UpdateEnvironmentRequest(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]]; + } + + /** + * UpdateEnvironmentRequest environment. + * @member {google.cloud.dialogflow.cx.v3beta1.IEnvironment|null|undefined} environment + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.environment = null; + + /** + * UpdateEnvironmentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest instance + */ + UpdateEnvironmentRequest.create = function create(properties) { + return new UpdateEnvironmentRequest(properties); + }; + + /** + * Encodes the specified UpdateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest} message UpdateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEnvironmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + $root.google.cloud.dialogflow.cx.v3beta1.Environment.encode(message.environment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest} message UpdateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @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.UpdateEnvironmentRequest} UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEnvironmentRequest.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.UpdateEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.environment = $root.google.cloud.dialogflow.cx.v3beta1.Environment.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEnvironmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environment != null && message.hasOwnProperty("environment")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Environment.verify(message.environment); + if (error) + return "environment." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest + */ + UpdateEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest(); + if (object.environment != null) { + if (typeof object.environment !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest.environment: object expected"); + message.environment = $root.google.cloud.dialogflow.cx.v3beta1.Environment.fromObject(object.environment); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest} message UpdateEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.environment = null; + object.updateMask = null; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = $root.google.cloud.dialogflow.cx.v3beta1.Environment.toObject(message.environment, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateEnvironmentRequest; + })(); + + v3beta1.DeleteEnvironmentRequest = (function() { + + /** + * Properties of a DeleteEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteEnvironmentRequest + * @property {string|null} [name] DeleteEnvironmentRequest name + */ + + /** + * Constructs a new DeleteEnvironmentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteEnvironmentRequest. + * @implements IDeleteEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest=} [properties] Properties to set + */ + function DeleteEnvironmentRequest(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]]; + } + + /** + * DeleteEnvironmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @instance + */ + DeleteEnvironmentRequest.prototype.name = ""; + + /** + * Creates a new DeleteEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest instance + */ + DeleteEnvironmentRequest.create = function create(properties) { + return new DeleteEnvironmentRequest(properties); + }; + + /** + * Encodes the specified DeleteEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest} message DeleteEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEnvironmentRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest} message DeleteEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @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.DeleteEnvironmentRequest} DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEnvironmentRequest.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.DeleteEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteEnvironmentRequest.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"; + return null; + }; + + /** + * Creates a DeleteEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest + */ + DeleteEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest} message DeleteEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteEnvironmentRequest; + })(); + + v3beta1.LookupEnvironmentHistoryRequest = (function() { + + /** + * Properties of a LookupEnvironmentHistoryRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ILookupEnvironmentHistoryRequest + * @property {string|null} [name] LookupEnvironmentHistoryRequest name + * @property {number|null} [pageSize] LookupEnvironmentHistoryRequest pageSize + * @property {string|null} [pageToken] LookupEnvironmentHistoryRequest pageToken + */ + + /** + * Constructs a new LookupEnvironmentHistoryRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a LookupEnvironmentHistoryRequest. + * @implements ILookupEnvironmentHistoryRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest=} [properties] Properties to set + */ + function LookupEnvironmentHistoryRequest(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]]; + } + + /** + * LookupEnvironmentHistoryRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @instance + */ + LookupEnvironmentHistoryRequest.prototype.name = ""; + + /** + * LookupEnvironmentHistoryRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @instance + */ + LookupEnvironmentHistoryRequest.prototype.pageSize = 0; + + /** + * LookupEnvironmentHistoryRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @instance + */ + LookupEnvironmentHistoryRequest.prototype.pageToken = ""; + + /** + * Creates a new LookupEnvironmentHistoryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest} LookupEnvironmentHistoryRequest instance + */ + LookupEnvironmentHistoryRequest.create = function create(properties) { + return new LookupEnvironmentHistoryRequest(properties); + }; + + /** + * Encodes the specified LookupEnvironmentHistoryRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest} message LookupEnvironmentHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LookupEnvironmentHistoryRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified LookupEnvironmentHistoryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest} message LookupEnvironmentHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LookupEnvironmentHistoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LookupEnvironmentHistoryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @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.LookupEnvironmentHistoryRequest} LookupEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LookupEnvironmentHistoryRequest.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.LookupEnvironmentHistoryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LookupEnvironmentHistoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest} LookupEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LookupEnvironmentHistoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LookupEnvironmentHistoryRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LookupEnvironmentHistoryRequest.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.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a LookupEnvironmentHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest} LookupEnvironmentHistoryRequest + */ + LookupEnvironmentHistoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a LookupEnvironmentHistoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest} message LookupEnvironmentHistoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LookupEnvironmentHistoryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this LookupEnvironmentHistoryRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest + * @instance + * @returns {Object.} JSON object + */ + LookupEnvironmentHistoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LookupEnvironmentHistoryRequest; + })(); + + v3beta1.LookupEnvironmentHistoryResponse = (function() { + + /** + * Properties of a LookupEnvironmentHistoryResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ILookupEnvironmentHistoryResponse + * @property {Array.|null} [environments] LookupEnvironmentHistoryResponse environments + * @property {string|null} [nextPageToken] LookupEnvironmentHistoryResponse nextPageToken + */ + + /** + * Constructs a new LookupEnvironmentHistoryResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a LookupEnvironmentHistoryResponse. + * @implements ILookupEnvironmentHistoryResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse=} [properties] Properties to set + */ + function LookupEnvironmentHistoryResponse(properties) { + this.environments = []; + 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]]; + } + + /** + * LookupEnvironmentHistoryResponse environments. + * @member {Array.} environments + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @instance + */ + LookupEnvironmentHistoryResponse.prototype.environments = $util.emptyArray; + + /** + * LookupEnvironmentHistoryResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @instance + */ + LookupEnvironmentHistoryResponse.prototype.nextPageToken = ""; + + /** + * Creates a new LookupEnvironmentHistoryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse} LookupEnvironmentHistoryResponse instance + */ + LookupEnvironmentHistoryResponse.create = function create(properties) { + return new LookupEnvironmentHistoryResponse(properties); + }; + + /** + * Encodes the specified LookupEnvironmentHistoryResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse} message LookupEnvironmentHistoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LookupEnvironmentHistoryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environments != null && message.environments.length) + for (var i = 0; i < message.environments.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Environment.encode(message.environments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified LookupEnvironmentHistoryResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse} message LookupEnvironmentHistoryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LookupEnvironmentHistoryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LookupEnvironmentHistoryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @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.LookupEnvironmentHistoryResponse} LookupEnvironmentHistoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LookupEnvironmentHistoryResponse.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.LookupEnvironmentHistoryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.environments && message.environments.length)) + message.environments = []; + message.environments.push($root.google.cloud.dialogflow.cx.v3beta1.Environment.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LookupEnvironmentHistoryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse} LookupEnvironmentHistoryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LookupEnvironmentHistoryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LookupEnvironmentHistoryResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LookupEnvironmentHistoryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environments != null && message.hasOwnProperty("environments")) { + if (!Array.isArray(message.environments)) + return "environments: array expected"; + for (var i = 0; i < message.environments.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Environment.verify(message.environments[i]); + if (error) + return "environments." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a LookupEnvironmentHistoryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse} LookupEnvironmentHistoryResponse + */ + LookupEnvironmentHistoryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse(); + if (object.environments) { + if (!Array.isArray(object.environments)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse.environments: array expected"); + message.environments = []; + for (var i = 0; i < object.environments.length; ++i) { + if (typeof object.environments[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse.environments: object expected"); + message.environments[i] = $root.google.cloud.dialogflow.cx.v3beta1.Environment.fromObject(object.environments[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a LookupEnvironmentHistoryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse} message LookupEnvironmentHistoryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LookupEnvironmentHistoryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.environments = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.environments && message.environments.length) { + object.environments = []; + for (var j = 0; j < message.environments.length; ++j) + object.environments[j] = $root.google.cloud.dialogflow.cx.v3beta1.Environment.toObject(message.environments[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this LookupEnvironmentHistoryResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryResponse + * @instance + * @returns {Object.} JSON object + */ + LookupEnvironmentHistoryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LookupEnvironmentHistoryResponse; + })(); + + v3beta1.Intents = (function() { + + /** + * Constructs a new Intents service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an Intents + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Intents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Intents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Intents; + + /** + * Creates new Intents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Intents} RPC service. Useful where requests and/or responses are streamed. + */ + Intents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#listIntents}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @typedef ListIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse} [response] ListIntentsResponse + */ + + /** + * Calls ListIntents. + * @function listIntents + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest} request ListIntentsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Intents.ListIntentsCallback} callback Node-style callback called with the error, if any, and ListIntentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.listIntents = function listIntents(request, callback) { + return this.rpcCall(listIntents, $root.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse, request, callback); + }, "name", { value: "ListIntents" }); + + /** + * Calls ListIntents. + * @function listIntents + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest} request ListIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#getIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @typedef GetIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Intent} [response] Intent + */ + + /** + * Calls GetIntent. + * @function getIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest} request GetIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Intents.GetIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.getIntent = function getIntent(request, callback) { + return this.rpcCall(getIntent, $root.google.cloud.dialogflow.cx.v3beta1.GetIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Intent, request, callback); + }, "name", { value: "GetIntent" }); + + /** + * Calls GetIntent. + * @function getIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest} request GetIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#createIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @typedef CreateIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Intent} [response] Intent + */ + + /** + * Calls CreateIntent. + * @function createIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest} request CreateIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.createIntent = function createIntent(request, callback) { + return this.rpcCall(createIntent, $root.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Intent, request, callback); + }, "name", { value: "CreateIntent" }); + + /** + * Calls CreateIntent. + * @function createIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest} request CreateIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#updateIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @typedef UpdateIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Intent} [response] Intent + */ + + /** + * Calls UpdateIntent. + * @function updateIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest} request UpdateIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.updateIntent = function updateIntent(request, callback) { + return this.rpcCall(updateIntent, $root.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.Intent, request, callback); + }, "name", { value: "UpdateIntent" }); + + /** + * Calls UpdateIntent. + * @function updateIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest} request UpdateIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Intents#deleteIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @typedef DeleteIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteIntent. + * @function deleteIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest} request DeleteIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Intents.DeleteIntentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.deleteIntent = function deleteIntent(request, callback) { + return this.rpcCall(deleteIntent, $root.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteIntent" }); + + /** + * Calls DeleteIntent. + * @function deleteIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Intents + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest} request DeleteIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Intents; + })(); + + v3beta1.Intent = (function() { + + /** + * Properties of an Intent. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IIntent + * @property {string|null} [name] Intent name + * @property {string|null} [displayName] Intent displayName + * @property {Array.|null} [trainingPhrases] Intent trainingPhrases + * @property {Array.|null} [parameters] Intent parameters + * @property {number|null} [priority] Intent priority + * @property {boolean|null} [isFallback] Intent isFallback + * @property {Object.|null} [labels] Intent labels + * @property {string|null} [description] Intent description + */ + + /** + * Constructs a new Intent. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an Intent. + * @implements IIntent + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IIntent=} [properties] Properties to set + */ + function Intent(properties) { + this.trainingPhrases = []; + this.parameters = []; + this.labels = {}; + 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]]; + } + + /** + * Intent name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.name = ""; + + /** + * Intent displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.displayName = ""; + + /** + * Intent trainingPhrases. + * @member {Array.} trainingPhrases + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.trainingPhrases = $util.emptyArray; + + /** + * Intent parameters. + * @member {Array.} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.parameters = $util.emptyArray; + + /** + * Intent priority. + * @member {number} priority + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.priority = 0; + + /** + * Intent isFallback. + * @member {boolean} isFallback + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.isFallback = false; + + /** + * Intent labels. + * @member {Object.} labels + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.labels = $util.emptyObject; + + /** + * Intent description. + * @member {string} description + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + */ + Intent.prototype.description = ""; + + /** + * Creates a new Intent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IIntent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent} Intent instance + */ + Intent.create = function create(properties) { + return new Intent(properties); + }; + + /** + * Encodes the specified Intent message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IIntent} message Intent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Intent.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.trainingPhrases != null && message.trainingPhrases.length) + for (var i = 0; i < message.trainingPhrases.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.encode(message.trainingPhrases[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.parameters != null && message.parameters.length) + for (var i = 0; i < message.parameters.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.encode(message.parameters[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + if (message.isFallback != null && Object.hasOwnProperty.call(message, "isFallback")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.isFallback); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.description); + return writer; + }; + + /** + * Encodes the specified Intent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IIntent} message Intent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Intent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Intent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @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.Intent} Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Intent.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.Intent(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + if (!(message.trainingPhrases && message.trainingPhrases.length)) + message.trainingPhrases = []; + message.trainingPhrases.push($root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.parameters && message.parameters.length)) + message.parameters = []; + message.parameters.push($root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.decode(reader, reader.uint32())); + break; + case 5: + message.priority = reader.int32(); + break; + case 6: + message.isFallback = reader.bool(); + break; + case 7: + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + case 8: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Intent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent} Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Intent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Intent message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Intent.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.trainingPhrases != null && message.hasOwnProperty("trainingPhrases")) { + if (!Array.isArray(message.trainingPhrases)) + return "trainingPhrases: array expected"; + for (var i = 0; i < message.trainingPhrases.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.verify(message.trainingPhrases[i]); + if (error) + return "trainingPhrases." + error; + } + } + if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (!Array.isArray(message.parameters)) + return "parameters: array expected"; + for (var i = 0; i < message.parameters.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.verify(message.parameters[i]); + if (error) + return "parameters." + error; + } + } + if (message.priority != null && message.hasOwnProperty("priority")) + if (!$util.isInteger(message.priority)) + return "priority: integer expected"; + if (message.isFallback != null && message.hasOwnProperty("isFallback")) + if (typeof message.isFallback !== "boolean") + return "isFallback: boolean expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates an Intent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent} Intent + */ + Intent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Intent) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Intent(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.trainingPhrases) { + if (!Array.isArray(object.trainingPhrases)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.trainingPhrases: array expected"); + message.trainingPhrases = []; + for (var i = 0; i < object.trainingPhrases.length; ++i) { + if (typeof object.trainingPhrases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.trainingPhrases: object expected"); + message.trainingPhrases[i] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.fromObject(object.trainingPhrases[i]); + } + } + if (object.parameters) { + if (!Array.isArray(object.parameters)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.parameters: array expected"); + message.parameters = []; + for (var i = 0; i < object.parameters.length; ++i) { + if (typeof object.parameters[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.parameters: object expected"); + message.parameters[i] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.fromObject(object.parameters[i]); + } + } + if (object.priority != null) + message.priority = object.priority | 0; + if (object.isFallback != null) + message.isFallback = Boolean(object.isFallback); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from an Intent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent} message Intent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Intent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.trainingPhrases = []; + object.parameters = []; + } + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.priority = 0; + object.isFallback = false; + object.description = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.trainingPhrases && message.trainingPhrases.length) { + object.trainingPhrases = []; + for (var j = 0; j < message.trainingPhrases.length; ++j) + object.trainingPhrases[j] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.toObject(message.trainingPhrases[j], options); + } + if (message.parameters && message.parameters.length) { + object.parameters = []; + for (var j = 0; j < message.parameters.length; ++j) + object.parameters[j] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.toObject(message.parameters[j], options); + } + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = message.priority; + if (message.isFallback != null && message.hasOwnProperty("isFallback")) + object.isFallback = message.isFallback; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this Intent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @instance + * @returns {Object.} JSON object + */ + Intent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Intent.TrainingPhrase = (function() { + + /** + * Properties of a TrainingPhrase. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @interface ITrainingPhrase + * @property {string|null} [id] TrainingPhrase id + * @property {Array.|null} [parts] TrainingPhrase parts + * @property {number|null} [repeatCount] TrainingPhrase repeatCount + */ + + /** + * Constructs a new TrainingPhrase. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @classdesc Represents a TrainingPhrase. + * @implements ITrainingPhrase + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase=} [properties] Properties to set + */ + function TrainingPhrase(properties) { + this.parts = []; + 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]]; + } + + /** + * TrainingPhrase id. + * @member {string} id + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.id = ""; + + /** + * TrainingPhrase parts. + * @member {Array.} parts + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.parts = $util.emptyArray; + + /** + * TrainingPhrase repeatCount. + * @member {number} repeatCount + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.repeatCount = 0; + + /** + * Creates a new TrainingPhrase instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase} TrainingPhrase instance + */ + TrainingPhrase.create = function create(properties) { + return new TrainingPhrase(properties); + }; + + /** + * Encodes the specified TrainingPhrase message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase} message TrainingPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainingPhrase.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.parts != null && message.parts.length) + for (var i = 0; i < message.parts.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.encode(message.parts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.repeatCount != null && Object.hasOwnProperty.call(message, "repeatCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatCount); + return writer; + }; + + /** + * Encodes the specified TrainingPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.ITrainingPhrase} message TrainingPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainingPhrase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @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.Intent.TrainingPhrase} TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainingPhrase.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.Intent.TrainingPhrase(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (!(message.parts && message.parts.length)) + message.parts = []; + message.parts.push($root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.decode(reader, reader.uint32())); + break; + case 3: + message.repeatCount = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase} TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainingPhrase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TrainingPhrase message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TrainingPhrase.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.parts != null && message.hasOwnProperty("parts")) { + if (!Array.isArray(message.parts)) + return "parts: array expected"; + for (var i = 0; i < message.parts.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.verify(message.parts[i]); + if (error) + return "parts." + error; + } + } + if (message.repeatCount != null && message.hasOwnProperty("repeatCount")) + if (!$util.isInteger(message.repeatCount)) + return "repeatCount: integer expected"; + return null; + }; + + /** + * Creates a TrainingPhrase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase} TrainingPhrase + */ + TrainingPhrase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase(); + if (object.id != null) + message.id = String(object.id); + if (object.parts) { + if (!Array.isArray(object.parts)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.parts: array expected"); + message.parts = []; + for (var i = 0; i < object.parts.length; ++i) { + if (typeof object.parts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.parts: object expected"); + message.parts[i] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.fromObject(object.parts[i]); + } + } + if (object.repeatCount != null) + message.repeatCount = object.repeatCount | 0; + return message; + }; + + /** + * Creates a plain object from a TrainingPhrase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase} message TrainingPhrase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TrainingPhrase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parts = []; + if (options.defaults) { + object.id = ""; + object.repeatCount = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.parts && message.parts.length) { + object.parts = []; + for (var j = 0; j < message.parts.length; ++j) + object.parts[j] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.toObject(message.parts[j], options); + } + if (message.repeatCount != null && message.hasOwnProperty("repeatCount")) + object.repeatCount = message.repeatCount; + return object; + }; + + /** + * Converts this TrainingPhrase to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @instance + * @returns {Object.} JSON object + */ + TrainingPhrase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TrainingPhrase.Part = (function() { + + /** + * Properties of a Part. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @interface IPart + * @property {string|null} [text] Part text + * @property {string|null} [parameterId] Part parameterId + */ + + /** + * Constructs a new Part. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase + * @classdesc Represents a Part. + * @implements IPart + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart=} [properties] Properties to set + */ + function Part(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]]; + } + + /** + * Part text. + * @member {string} text + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.text = ""; + + /** + * Part parameterId. + * @member {string} parameterId + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.parameterId = ""; + + /** + * Creates a new Part instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part} Part instance + */ + Part.create = function create(properties) { + return new Part(properties); + }; + + /** + * Encodes the specified Part message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.parameterId != null && Object.hasOwnProperty.call(message, "parameterId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.parameterId); + return writer; + }; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Part message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @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.Intent.TrainingPhrase.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.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.Intent.TrainingPhrase.Part(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + case 2: + message.parameterId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Part message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Part.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.parameterId != null && message.hasOwnProperty("parameterId")) + if (!$util.isString(message.parameterId)) + return "parameterId: string expected"; + return null; + }; + + /** + * Creates a Part message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part} Part + */ + Part.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part(); + if (object.text != null) + message.text = String(object.text); + if (object.parameterId != null) + message.parameterId = String(object.parameterId); + return message; + }; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part} message Part + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Part.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.parameterId = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.parameterId != null && message.hasOwnProperty("parameterId")) + object.parameterId = message.parameterId; + return object; + }; + + /** + * Converts this Part to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part + * @instance + * @returns {Object.} JSON object + */ + Part.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Part; + })(); + + return TrainingPhrase; + })(); + + Intent.Parameter = (function() { + + /** + * Properties of a Parameter. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @interface IParameter + * @property {string|null} [id] Parameter id + * @property {string|null} [entityType] Parameter entityType + * @property {boolean|null} [isList] Parameter isList + * @property {boolean|null} [redact] Parameter redact + */ + + /** + * Constructs a new Parameter. + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent + * @classdesc Represents a Parameter. + * @implements IParameter + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.IParameter=} [properties] Properties to set + */ + function Parameter(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]]; + } + + /** + * Parameter id. + * @member {string} id + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.id = ""; + + /** + * Parameter entityType. + * @member {string} entityType + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.entityType = ""; + + /** + * Parameter isList. + * @member {boolean} isList + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.isList = false; + + /** + * Parameter redact. + * @member {boolean} redact + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.redact = false; + + /** + * Creates a new Parameter instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.IParameter=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.Parameter} Parameter instance + */ + Parameter.create = function create(properties) { + return new Parameter(properties); + }; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityType); + if (message.isList != null && Object.hasOwnProperty.call(message, "isList")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isList); + if (message.redact != null && Object.hasOwnProperty.call(message, "redact")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.redact); + return writer; + }; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Intent.Parameter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @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.Intent.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.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.Intent.Parameter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.entityType = reader.string(); + break; + case 3: + message.isList = reader.bool(); + break; + case 4: + message.redact = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Parameter message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Parameter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) + if (!$util.isString(message.entityType)) + return "entityType: string expected"; + if (message.isList != null && message.hasOwnProperty("isList")) + if (typeof message.isList !== "boolean") + return "isList: boolean expected"; + if (message.redact != null && message.hasOwnProperty("redact")) + if (typeof message.redact !== "boolean") + return "redact: boolean expected"; + return null; + }; + + /** + * Creates a Parameter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Intent.Parameter} Parameter + */ + Parameter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Intent.Parameter(); + if (object.id != null) + message.id = String(object.id); + if (object.entityType != null) + message.entityType = String(object.entityType); + if (object.isList != null) + message.isList = Boolean(object.isList); + if (object.redact != null) + message.redact = Boolean(object.redact); + return message; + }; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Intent.Parameter} message Parameter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Parameter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.entityType = ""; + object.isList = false; + object.redact = false; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = message.entityType; + if (message.isList != null && message.hasOwnProperty("isList")) + object.isList = message.isList; + if (message.redact != null && message.hasOwnProperty("redact")) + object.redact = message.redact; + return object; + }; + + /** + * Converts this Parameter to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Intent.Parameter + * @instance + * @returns {Object.} JSON object + */ + Parameter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Parameter; + })(); + + return Intent; + })(); + + v3beta1.ListIntentsRequest = (function() { + + /** + * Properties of a ListIntentsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListIntentsRequest + * @property {string|null} [parent] ListIntentsRequest parent + * @property {string|null} [languageCode] ListIntentsRequest languageCode + * @property {google.cloud.dialogflow.cx.v3beta1.IntentView|null} [intentView] ListIntentsRequest intentView + * @property {number|null} [pageSize] ListIntentsRequest pageSize + * @property {string|null} [pageToken] ListIntentsRequest pageToken + */ + + /** + * Constructs a new ListIntentsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListIntentsRequest. + * @implements IListIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest=} [properties] Properties to set + */ + function ListIntentsRequest(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]]; + } + + /** + * ListIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.parent = ""; + + /** + * ListIntentsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.languageCode = ""; + + /** + * ListIntentsRequest intentView. + * @member {google.cloud.dialogflow.cx.v3beta1.IntentView} intentView + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.intentView = 0; + + /** + * ListIntentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.pageSize = 0; + + /** + * ListIntentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest} ListIntentsRequest instance + */ + ListIntentsRequest.create = function create(properties) { + return new ListIntentsRequest(properties); + }; + + /** + * Encodes the specified ListIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest} message ListIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified ListIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest} message ListIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @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.ListIntentsRequest} ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsRequest.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.ListIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + case 5: + message.intentView = reader.int32(); + break; + case 3: + message.pageSize = reader.int32(); + break; + case 4: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest} ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIntentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest} ListIntentsRequest + */ + ListIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_PARTIAL": + case 1: + message.intentView = 1; + break; + case "INTENT_VIEW_FULL": + case 2: + message.intentView = 2; + break; + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest} message ListIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.pageSize = 0; + object.pageToken = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this ListIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListIntentsRequest; + })(); + + v3beta1.ListIntentsResponse = (function() { + + /** + * Properties of a ListIntentsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListIntentsResponse + * @property {Array.|null} [intents] ListIntentsResponse intents + * @property {string|null} [nextPageToken] ListIntentsResponse nextPageToken + */ + + /** + * Constructs a new ListIntentsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListIntentsResponse. + * @implements IListIntentsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse=} [properties] Properties to set + */ + function ListIntentsResponse(properties) { + this.intents = []; + 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]]; + } + + /** + * ListIntentsResponse intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @instance + */ + ListIntentsResponse.prototype.intents = $util.emptyArray; + + /** + * ListIntentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @instance + */ + ListIntentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListIntentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse} ListIntentsResponse instance + */ + ListIntentsResponse.create = function create(properties) { + return new ListIntentsResponse(properties); + }; + + /** + * Encodes the specified ListIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse} message ListIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.encode(message.intents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse} message ListIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @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.ListIntentsResponse} ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsResponse.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.ListIntentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.cx.v3beta1.Intent.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse} ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIntentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIntentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse} ListIntentsResponse + */ + ListIntentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.fromObject(object.intents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListIntentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse} message ListIntentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIntentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.cx.v3beta1.Intent.toObject(message.intents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListIntentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListIntentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListIntentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListIntentsResponse; + })(); + + v3beta1.GetIntentRequest = (function() { + + /** + * Properties of a GetIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetIntentRequest + * @property {string|null} [name] GetIntentRequest name + * @property {string|null} [languageCode] GetIntentRequest languageCode + */ + + /** + * Constructs a new GetIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetIntentRequest. + * @implements IGetIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest=} [properties] Properties to set + */ + function GetIntentRequest(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]]; + } + + /** + * GetIntentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.name = ""; + + /** + * GetIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.languageCode = ""; + + /** + * Creates a new GetIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetIntentRequest} GetIntentRequest instance + */ + GetIntentRequest.create = function create(properties) { + return new GetIntentRequest(properties); + }; + + /** + * Encodes the specified GetIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest} message GetIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIntentRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest} message GetIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @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.GetIntentRequest} GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIntentRequest.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.GetIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetIntentRequest} GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIntentRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetIntentRequest} GetIntentRequest + */ + GetIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetIntentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetIntentRequest} message GetIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetIntentRequest + * @instance + * @returns {Object.} JSON object + */ + GetIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIntentRequest; + })(); + + v3beta1.CreateIntentRequest = (function() { + + /** + * Properties of a CreateIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateIntentRequest + * @property {string|null} [parent] CreateIntentRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IIntent|null} [intent] CreateIntentRequest intent + * @property {string|null} [languageCode] CreateIntentRequest languageCode + */ + + /** + * Constructs a new CreateIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateIntentRequest. + * @implements ICreateIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest=} [properties] Properties to set + */ + function CreateIntentRequest(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]]; + } + + /** + * CreateIntentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.parent = ""; + + /** + * CreateIntentRequest intent. + * @member {google.cloud.dialogflow.cx.v3beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.intent = null; + + /** + * CreateIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.languageCode = ""; + + /** + * Creates a new CreateIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest} CreateIntentRequest instance + */ + CreateIntentRequest.create = function create(properties) { + return new CreateIntentRequest(properties); + }; + + /** + * Encodes the specified CreateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest} message CreateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIntentRequest.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.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.encode(message.intent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest} message CreateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @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.CreateIntentRequest} CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIntentRequest.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.CreateIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest} CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest} CreateIntentRequest + */ + CreateIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.fromObject(object.intent); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreateIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest} message CreateIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.intent = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.toObject(message.intent, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreateIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateIntentRequest; + })(); + + v3beta1.UpdateIntentRequest = (function() { + + /** + * Properties of an UpdateIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateIntentRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IIntent|null} [intent] UpdateIntentRequest intent + * @property {string|null} [languageCode] UpdateIntentRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateIntentRequest updateMask + */ + + /** + * Constructs a new UpdateIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateIntentRequest. + * @implements IUpdateIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest=} [properties] Properties to set + */ + function UpdateIntentRequest(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]]; + } + + /** + * UpdateIntentRequest intent. + * @member {google.cloud.dialogflow.cx.v3beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.intent = null; + + /** + * UpdateIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.languageCode = ""; + + /** + * UpdateIntentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest} UpdateIntentRequest instance + */ + UpdateIntentRequest.create = function create(properties) { + return new UpdateIntentRequest(properties); + }; + + /** + * Encodes the specified UpdateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest} message UpdateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.encode(message.intent, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest} message UpdateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @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.UpdateIntentRequest} UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateIntentRequest.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.UpdateIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.decode(reader, reader.uint32()); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest} UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest} UpdateIntentRequest + */ + UpdateIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest(); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.fromObject(object.intent); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest} message UpdateIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.intent = null; + object.languageCode = ""; + object.updateMask = null; + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.toObject(message.intent, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateIntentRequest; + })(); + + v3beta1.DeleteIntentRequest = (function() { + + /** + * Properties of a DeleteIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteIntentRequest + * @property {string|null} [name] DeleteIntentRequest name + */ + + /** + * Constructs a new DeleteIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteIntentRequest. + * @implements IDeleteIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest=} [properties] Properties to set + */ + function DeleteIntentRequest(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]]; + } + + /** + * DeleteIntentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @instance + */ + DeleteIntentRequest.prototype.name = ""; + + /** + * Creates a new DeleteIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest} DeleteIntentRequest instance + */ + DeleteIntentRequest.create = function create(properties) { + return new DeleteIntentRequest(properties); + }; + + /** + * Encodes the specified DeleteIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest} message DeleteIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIntentRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest} message DeleteIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @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.DeleteIntentRequest} DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIntentRequest.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.DeleteIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest} DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteIntentRequest.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"; + return null; + }; + + /** + * Creates a DeleteIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest} DeleteIntentRequest + */ + DeleteIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest} message DeleteIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteIntentRequest; + })(); + + /** + * IntentView enum. + * @name google.cloud.dialogflow.cx.v3beta1.IntentView + * @enum {number} + * @property {number} INTENT_VIEW_UNSPECIFIED=0 INTENT_VIEW_UNSPECIFIED value + * @property {number} INTENT_VIEW_PARTIAL=1 INTENT_VIEW_PARTIAL value + * @property {number} INTENT_VIEW_FULL=2 INTENT_VIEW_FULL value + */ + v3beta1.IntentView = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INTENT_VIEW_UNSPECIFIED"] = 0; + values[valuesById[1] = "INTENT_VIEW_PARTIAL"] = 1; + values[valuesById[2] = "INTENT_VIEW_FULL"] = 2; + return values; + })(); + + v3beta1.Sessions = (function() { + + /** + * Constructs a new Sessions service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Sessions + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Sessions(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Sessions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Sessions; + + /** + * Creates new Sessions service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Sessions} RPC service. Useful where requests and/or responses are streamed. + */ + Sessions.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#detectIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @typedef DetectIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse} [response] DetectIntentResponse + */ + + /** + * Calls DetectIntent. + * @function detectIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest} request DetectIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntentCallback} callback Node-style callback called with the error, if any, and DetectIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.detectIntent = function detectIntent(request, callback) { + return this.rpcCall(detectIntent, $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse, request, callback); + }, "name", { value: "DetectIntent" }); + + /** + * Calls DetectIntent. + * @function detectIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest} request DetectIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#streamingDetectIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @typedef StreamingDetectIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse} [response] StreamingDetectIntentResponse + */ + + /** + * Calls StreamingDetectIntent. + * @function streamingDetectIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest} request StreamingDetectIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntentCallback} callback Node-style callback called with the error, if any, and StreamingDetectIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.streamingDetectIntent = function streamingDetectIntent(request, callback) { + return this.rpcCall(streamingDetectIntent, $root.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse, request, callback); + }, "name", { value: "StreamingDetectIntent" }); + + /** + * Calls StreamingDetectIntent. + * @function streamingDetectIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest} request StreamingDetectIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#matchIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @typedef MatchIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse} [response] MatchIntentResponse + */ + + /** + * Calls MatchIntent. + * @function matchIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest} request MatchIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntentCallback} callback Node-style callback called with the error, if any, and MatchIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.matchIntent = function matchIntent(request, callback) { + return this.rpcCall(matchIntent, $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse, request, callback); + }, "name", { value: "MatchIntent" }); + + /** + * Calls MatchIntent. + * @function matchIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest} request MatchIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Sessions#fulfillIntent}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @typedef FulfillIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse} [response] FulfillIntentResponse + */ + + /** + * Calls FulfillIntent. + * @function fulfillIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest} request FulfillIntentRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Sessions.FulfillIntentCallback} callback Node-style callback called with the error, if any, and FulfillIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.fulfillIntent = function fulfillIntent(request, callback) { + return this.rpcCall(fulfillIntent, $root.google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest, $root.google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse, request, callback); + }, "name", { value: "FulfillIntent" }); + + /** + * Calls FulfillIntent. + * @function fulfillIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest} request FulfillIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Sessions; + })(); + + v3beta1.DetectIntentRequest = (function() { + + /** + * Properties of a DetectIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDetectIntentRequest + * @property {string|null} [session] DetectIntentRequest session + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null} [queryParams] DetectIntentRequest queryParams + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryInput|null} [queryInput] DetectIntentRequest queryInput + * @property {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null} [outputAudioConfig] DetectIntentRequest outputAudioConfig + */ + + /** + * Constructs a new DetectIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DetectIntentRequest. + * @implements IDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest=} [properties] Properties to set + */ + function DetectIntentRequest(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]]; + } + + /** + * DetectIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.session = ""; + + /** + * DetectIntentRequest queryParams. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.queryParams = null; + + /** + * DetectIntentRequest queryInput. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.queryInput = null; + + /** + * DetectIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.outputAudioConfig = null; + + /** + * Creates a new DetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest} DetectIntentRequest instance + */ + DetectIntentRequest.create = function create(properties) { + return new DetectIntentRequest(properties); + }; + + /** + * Encodes the specified DetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest} message DetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest} message DetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @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.DetectIntentRequest} DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentRequest.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.DetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.session = reader.string(); + break; + case 2: + message.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.decode(reader, reader.uint32()); + break; + case 3: + message.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.decode(reader, reader.uint32()); + break; + case 4: + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest} DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a DetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest} DetectIntentRequest + */ + DetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.fromObject(object.queryInput); + } + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a DetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest} message DetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + object.outputAudioConfig = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.toObject(message.queryInput, options); + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this DetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + DetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectIntentRequest; + })(); + + v3beta1.DetectIntentResponse = (function() { + + /** + * Properties of a DetectIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDetectIntentResponse + * @property {string|null} [responseId] DetectIntentResponse responseId + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryResult|null} [queryResult] DetectIntentResponse queryResult + * @property {Uint8Array|null} [outputAudio] DetectIntentResponse outputAudio + * @property {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null} [outputAudioConfig] DetectIntentResponse outputAudioConfig + */ + + /** + * Constructs a new DetectIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DetectIntentResponse. + * @implements IDetectIntentResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse=} [properties] Properties to set + */ + function DetectIntentResponse(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]]; + } + + /** + * DetectIntentResponse responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.responseId = ""; + + /** + * DetectIntentResponse queryResult. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.queryResult = null; + + /** + * DetectIntentResponse outputAudio. + * @member {Uint8Array} outputAudio + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.outputAudio = $util.newBuffer([]); + + /** + * DetectIntentResponse outputAudioConfig. + * @member {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.outputAudioConfig = null; + + /** + * Creates a new DetectIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse} DetectIntentResponse instance + */ + DetectIntentResponse.create = function create(properties) { + return new DetectIntentResponse(properties); + }; + + /** + * Encodes the specified DetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse} message DetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.encode(message.queryResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputAudio != null && Object.hasOwnProperty.call(message, "outputAudio")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.outputAudio); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse} message DetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @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.DetectIntentResponse} DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentResponse.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.DetectIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.responseId = reader.string(); + break; + case 2: + message.queryResult = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.decode(reader, reader.uint32()); + break; + case 4: + message.outputAudio = reader.bytes(); + break; + case 5: + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse} DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + if (!(message.outputAudio && typeof message.outputAudio.length === "number" || $util.isString(message.outputAudio))) + return "outputAudio: buffer expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a DetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse} DetectIntentResponse + */ + DetectIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse(); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.fromObject(object.queryResult); + } + if (object.outputAudio != null) + if (typeof object.outputAudio === "string") + $util.base64.decode(object.outputAudio, message.outputAudio = $util.newBuffer($util.base64.length(object.outputAudio)), 0); + else if (object.outputAudio.length) + message.outputAudio = object.outputAudio; + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a DetectIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse} message DetectIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseId = ""; + object.queryResult = null; + if (options.bytes === String) + object.outputAudio = ""; + else { + object.outputAudio = []; + if (options.bytes !== Array) + object.outputAudio = $util.newBuffer(object.outputAudio); + } + object.outputAudioConfig = null; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.toObject(message.queryResult, options); + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + object.outputAudio = options.bytes === String ? $util.base64.encode(message.outputAudio, 0, message.outputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.outputAudio) : message.outputAudio; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this DetectIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse + * @instance + * @returns {Object.} JSON object + */ + DetectIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectIntentResponse; + })(); + + v3beta1.StreamingDetectIntentRequest = (function() { + + /** + * Properties of a StreamingDetectIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IStreamingDetectIntentRequest + * @property {string|null} [session] StreamingDetectIntentRequest session + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null} [queryParams] StreamingDetectIntentRequest queryParams + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryInput|null} [queryInput] StreamingDetectIntentRequest queryInput + * @property {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null} [outputAudioConfig] StreamingDetectIntentRequest outputAudioConfig + */ + + /** + * Constructs a new StreamingDetectIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a StreamingDetectIntentRequest. + * @implements IStreamingDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest=} [properties] Properties to set + */ + function StreamingDetectIntentRequest(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]]; + } + + /** + * StreamingDetectIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.session = ""; + + /** + * StreamingDetectIntentRequest queryParams. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.queryParams = null; + + /** + * StreamingDetectIntentRequest queryInput. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.queryInput = null; + + /** + * StreamingDetectIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.outputAudioConfig = null; + + /** + * Creates a new StreamingDetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest instance + */ + StreamingDetectIntentRequest.create = function create(properties) { + return new StreamingDetectIntentRequest(properties); + }; + + /** + * Encodes the specified StreamingDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest} message StreamingDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentRequest} message StreamingDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @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.StreamingDetectIntentRequest} StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentRequest.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.StreamingDetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.session = reader.string(); + break; + case 2: + message.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.decode(reader, reader.uint32()); + break; + case 3: + message.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.decode(reader, reader.uint32()); + break; + case 4: + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingDetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingDetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a StreamingDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest + */ + StreamingDetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.fromObject(object.queryInput); + } + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a StreamingDetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest} message StreamingDetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingDetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + object.outputAudioConfig = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.toObject(message.queryInput, options); + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this StreamingDetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingDetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StreamingDetectIntentRequest; + })(); + + v3beta1.StreamingDetectIntentResponse = (function() { + + /** + * Properties of a StreamingDetectIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IStreamingDetectIntentResponse + * @property {google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult|null} [recognitionResult] StreamingDetectIntentResponse recognitionResult + * @property {google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse|null} [detectIntentResponse] StreamingDetectIntentResponse detectIntentResponse + */ + + /** + * Constructs a new StreamingDetectIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a StreamingDetectIntentResponse. + * @implements IStreamingDetectIntentResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse=} [properties] Properties to set + */ + function StreamingDetectIntentResponse(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]]; + } + + /** + * StreamingDetectIntentResponse recognitionResult. + * @member {google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult|null|undefined} recognitionResult + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.recognitionResult = null; + + /** + * StreamingDetectIntentResponse detectIntentResponse. + * @member {google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse|null|undefined} detectIntentResponse + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.detectIntentResponse = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * StreamingDetectIntentResponse response. + * @member {"recognitionResult"|"detectIntentResponse"|undefined} response + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @instance + */ + Object.defineProperty(StreamingDetectIntentResponse.prototype, "response", { + get: $util.oneOfGetter($oneOfFields = ["recognitionResult", "detectIntentResponse"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new StreamingDetectIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse instance + */ + StreamingDetectIntentResponse.create = function create(properties) { + return new StreamingDetectIntentResponse(properties); + }; + + /** + * Encodes the specified StreamingDetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse} message StreamingDetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recognitionResult != null && Object.hasOwnProperty.call(message, "recognitionResult")) + $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.encode(message.recognitionResult, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectIntentResponse != null && Object.hasOwnProperty.call(message, "detectIntentResponse")) + $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.encode(message.detectIntentResponse, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingDetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingDetectIntentResponse} message StreamingDetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @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.StreamingDetectIntentResponse} StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentResponse.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.StreamingDetectIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.recognitionResult = $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.decode(reader, reader.uint32()); + break; + case 2: + message.detectIntentResponse = $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingDetectIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingDetectIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + properties.response = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.verify(message.recognitionResult); + if (error) + return "recognitionResult." + error; + } + } + if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) { + if (properties.response === 1) + return "response: multiple values"; + properties.response = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.verify(message.detectIntentResponse); + if (error) + return "detectIntentResponse." + error; + } + } + return null; + }; + + /** + * Creates a StreamingDetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse + */ + StreamingDetectIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse(); + if (object.recognitionResult != null) { + if (typeof object.recognitionResult !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse.recognitionResult: object expected"); + message.recognitionResult = $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.fromObject(object.recognitionResult); + } + if (object.detectIntentResponse != null) { + if (typeof object.detectIntentResponse !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse.detectIntentResponse: object expected"); + message.detectIntentResponse = $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.fromObject(object.detectIntentResponse); + } + return message; + }; + + /** + * Creates a plain object from a StreamingDetectIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse} message StreamingDetectIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingDetectIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + object.recognitionResult = $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.toObject(message.recognitionResult, options); + if (options.oneofs) + object.response = "recognitionResult"; + } + if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) { + object.detectIntentResponse = $root.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse.toObject(message.detectIntentResponse, options); + if (options.oneofs) + object.response = "detectIntentResponse"; + } + return object; + }; + + /** + * Converts this StreamingDetectIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingDetectIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StreamingDetectIntentResponse; + })(); + + v3beta1.StreamingRecognitionResult = (function() { + + /** + * Properties of a StreamingRecognitionResult. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IStreamingRecognitionResult + * @property {google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType|null} [messageType] StreamingRecognitionResult messageType + * @property {string|null} [transcript] StreamingRecognitionResult transcript + * @property {boolean|null} [isFinal] StreamingRecognitionResult isFinal + * @property {number|null} [confidence] StreamingRecognitionResult confidence + * @property {number|null} [stability] StreamingRecognitionResult stability + * @property {Array.|null} [speechWordInfo] StreamingRecognitionResult speechWordInfo + * @property {google.protobuf.IDuration|null} [speechEndOffset] StreamingRecognitionResult speechEndOffset + */ + + /** + * Constructs a new StreamingRecognitionResult. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a StreamingRecognitionResult. + * @implements IStreamingRecognitionResult + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult=} [properties] Properties to set + */ + function StreamingRecognitionResult(properties) { + this.speechWordInfo = []; + 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]]; + } + + /** + * StreamingRecognitionResult messageType. + * @member {google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType} messageType + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.messageType = 0; + + /** + * StreamingRecognitionResult transcript. + * @member {string} transcript + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.transcript = ""; + + /** + * StreamingRecognitionResult isFinal. + * @member {boolean} isFinal + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.isFinal = false; + + /** + * StreamingRecognitionResult confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.confidence = 0; + + /** + * StreamingRecognitionResult stability. + * @member {number} stability + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.stability = 0; + + /** + * StreamingRecognitionResult speechWordInfo. + * @member {Array.} speechWordInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.speechWordInfo = $util.emptyArray; + + /** + * StreamingRecognitionResult speechEndOffset. + * @member {google.protobuf.IDuration|null|undefined} speechEndOffset + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.speechEndOffset = null; + + /** + * Creates a new StreamingRecognitionResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult} StreamingRecognitionResult instance + */ + StreamingRecognitionResult.create = function create(properties) { + return new StreamingRecognitionResult(properties); + }; + + /** + * Encodes the specified StreamingRecognitionResult message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult} message StreamingRecognitionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRecognitionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.messageType); + if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.transcript); + if (message.isFinal != null && Object.hasOwnProperty.call(message, "isFinal")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isFinal); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + if (message.stability != null && Object.hasOwnProperty.call(message, "stability")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.stability); + if (message.speechWordInfo != null && message.speechWordInfo.length) + for (var i = 0; i < message.speechWordInfo.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.encode(message.speechWordInfo[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.speechEndOffset != null && Object.hasOwnProperty.call(message, "speechEndOffset")) + $root.google.protobuf.Duration.encode(message.speechEndOffset, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IStreamingRecognitionResult} message StreamingRecognitionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRecognitionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @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.StreamingRecognitionResult} StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRecognitionResult.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.StreamingRecognitionResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageType = reader.int32(); + break; + case 2: + message.transcript = reader.string(); + break; + case 3: + message.isFinal = reader.bool(); + break; + case 4: + message.confidence = reader.float(); + break; + case 6: + message.stability = reader.float(); + break; + case 7: + if (!(message.speechWordInfo && message.speechWordInfo.length)) + message.speechWordInfo = []; + message.speechWordInfo.push($root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.decode(reader, reader.uint32())); + break; + case 8: + message.speechEndOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult} StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRecognitionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRecognitionResult message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRecognitionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageType != null && message.hasOwnProperty("messageType")) + switch (message.messageType) { + default: + return "messageType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) + if (!$util.isString(message.transcript)) + return "transcript: string expected"; + if (message.isFinal != null && message.hasOwnProperty("isFinal")) + if (typeof message.isFinal !== "boolean") + return "isFinal: boolean expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.stability != null && message.hasOwnProperty("stability")) + if (typeof message.stability !== "number") + return "stability: number expected"; + if (message.speechWordInfo != null && message.hasOwnProperty("speechWordInfo")) { + if (!Array.isArray(message.speechWordInfo)) + return "speechWordInfo: array expected"; + for (var i = 0; i < message.speechWordInfo.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.verify(message.speechWordInfo[i]); + if (error) + return "speechWordInfo." + error; + } + } + if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) { + var error = $root.google.protobuf.Duration.verify(message.speechEndOffset); + if (error) + return "speechEndOffset." + error; + } + return null; + }; + + /** + * Creates a StreamingRecognitionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult} StreamingRecognitionResult + */ + StreamingRecognitionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult(); + switch (object.messageType) { + case "MESSAGE_TYPE_UNSPECIFIED": + case 0: + message.messageType = 0; + break; + case "TRANSCRIPT": + case 1: + message.messageType = 1; + break; + case "END_OF_SINGLE_UTTERANCE": + case 2: + message.messageType = 2; + break; + } + if (object.transcript != null) + message.transcript = String(object.transcript); + if (object.isFinal != null) + message.isFinal = Boolean(object.isFinal); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.stability != null) + message.stability = Number(object.stability); + if (object.speechWordInfo) { + if (!Array.isArray(object.speechWordInfo)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.speechWordInfo: array expected"); + message.speechWordInfo = []; + for (var i = 0; i < object.speechWordInfo.length; ++i) { + if (typeof object.speechWordInfo[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.speechWordInfo: object expected"); + message.speechWordInfo[i] = $root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.fromObject(object.speechWordInfo[i]); + } + } + if (object.speechEndOffset != null) { + if (typeof object.speechEndOffset !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.speechEndOffset: object expected"); + message.speechEndOffset = $root.google.protobuf.Duration.fromObject(object.speechEndOffset); + } + return message; + }; + + /** + * Creates a plain object from a StreamingRecognitionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult} message StreamingRecognitionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRecognitionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.speechWordInfo = []; + if (options.defaults) { + object.messageType = options.enums === String ? "MESSAGE_TYPE_UNSPECIFIED" : 0; + object.transcript = ""; + object.isFinal = false; + object.confidence = 0; + object.stability = 0; + object.speechEndOffset = null; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) + object.messageType = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType[message.messageType] : message.messageType; + if (message.transcript != null && message.hasOwnProperty("transcript")) + object.transcript = message.transcript; + if (message.isFinal != null && message.hasOwnProperty("isFinal")) + object.isFinal = message.isFinal; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.stability != null && message.hasOwnProperty("stability")) + object.stability = options.json && !isFinite(message.stability) ? String(message.stability) : message.stability; + if (message.speechWordInfo && message.speechWordInfo.length) { + object.speechWordInfo = []; + for (var j = 0; j < message.speechWordInfo.length; ++j) + object.speechWordInfo[j] = $root.google.cloud.dialogflow.cx.v3beta1.SpeechWordInfo.toObject(message.speechWordInfo[j], options); + } + if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) + object.speechEndOffset = $root.google.protobuf.Duration.toObject(message.speechEndOffset, options); + return object; + }; + + /** + * Converts this StreamingRecognitionResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult + * @instance + * @returns {Object.} JSON object + */ + StreamingRecognitionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * MessageType enum. + * @name google.cloud.dialogflow.cx.v3beta1.StreamingRecognitionResult.MessageType + * @enum {number} + * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value + * @property {number} TRANSCRIPT=1 TRANSCRIPT value + * @property {number} END_OF_SINGLE_UTTERANCE=2 END_OF_SINGLE_UTTERANCE value + */ + StreamingRecognitionResult.MessageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "TRANSCRIPT"] = 1; + values[valuesById[2] = "END_OF_SINGLE_UTTERANCE"] = 2; + return values; + })(); + + return StreamingRecognitionResult; + })(); + + v3beta1.QueryParameters = (function() { + + /** + * Properties of a QueryParameters. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IQueryParameters + * @property {string|null} [timeZone] QueryParameters timeZone + * @property {google.type.ILatLng|null} [geoLocation] QueryParameters geoLocation + * @property {Array.|null} [sessionEntityTypes] QueryParameters sessionEntityTypes + * @property {google.protobuf.IStruct|null} [payload] QueryParameters payload + * @property {google.protobuf.IStruct|null} [parameters] QueryParameters parameters + * @property {boolean|null} [analyzeQueryTextSentiment] QueryParameters analyzeQueryTextSentiment + */ + + /** + * Constructs a new QueryParameters. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a QueryParameters. + * @implements IQueryParameters + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryParameters=} [properties] Properties to set + */ + function QueryParameters(properties) { + this.sessionEntityTypes = []; + 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]]; + } + + /** + * QueryParameters timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.timeZone = ""; + + /** + * QueryParameters geoLocation. + * @member {google.type.ILatLng|null|undefined} geoLocation + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.geoLocation = null; + + /** + * QueryParameters sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * QueryParameters payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.payload = null; + + /** + * QueryParameters parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.parameters = null; + + /** + * QueryParameters analyzeQueryTextSentiment. + * @member {boolean} analyzeQueryTextSentiment + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.analyzeQueryTextSentiment = false; + + /** + * Creates a new QueryParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryParameters} QueryParameters instance + */ + QueryParameters.create = function create(properties) { + return new QueryParameters(properties); + }; + + /** + * Encodes the specified QueryParameters message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryParameters} message QueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.timeZone); + if (message.geoLocation != null && Object.hasOwnProperty.call(message, "geoLocation")) + $root.google.type.LatLng.encode(message.geoLocation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.encode(message.sessionEntityTypes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.analyzeQueryTextSentiment != null && Object.hasOwnProperty.call(message, "analyzeQueryTextSentiment")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.analyzeQueryTextSentiment); + return writer; + }; + + /** + * Encodes the specified QueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryParameters} message QueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @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.QueryParameters} QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParameters.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.QueryParameters(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timeZone = reader.string(); + break; + case 2: + message.geoLocation = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.decode(reader, reader.uint32())); + break; + case 4: + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 5: + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 8: + message.analyzeQueryTextSentiment = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryParameters} QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParameters message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.geoLocation != null && message.hasOwnProperty("geoLocation")) { + var error = $root.google.type.LatLng.verify(message.geoLocation); + if (error) + return "geoLocation." + error; + } + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.analyzeQueryTextSentiment != null && message.hasOwnProperty("analyzeQueryTextSentiment")) + if (typeof message.analyzeQueryTextSentiment !== "boolean") + return "analyzeQueryTextSentiment: boolean expected"; + return null; + }; + + /** + * Creates a QueryParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryParameters} QueryParameters + */ + QueryParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters(); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.geoLocation != null) { + if (typeof object.geoLocation !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryParameters.geoLocation: object expected"); + message.geoLocation = $root.google.type.LatLng.fromObject(object.geoLocation); + } + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryParameters.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryParameters.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryParameters.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryParameters.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.analyzeQueryTextSentiment != null) + message.analyzeQueryTextSentiment = Boolean(object.analyzeQueryTextSentiment); + return message; + }; + + /** + * Creates a plain object from a QueryParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.QueryParameters} message QueryParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sessionEntityTypes = []; + if (options.defaults) { + object.timeZone = ""; + object.geoLocation = null; + object.payload = null; + object.parameters = null; + object.analyzeQueryTextSentiment = false; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.geoLocation != null && message.hasOwnProperty("geoLocation")) + object.geoLocation = $root.google.type.LatLng.toObject(message.geoLocation, options); + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.analyzeQueryTextSentiment != null && message.hasOwnProperty("analyzeQueryTextSentiment")) + object.analyzeQueryTextSentiment = message.analyzeQueryTextSentiment; + return object; + }; + + /** + * Converts this QueryParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryParameters + * @instance + * @returns {Object.} JSON object + */ + QueryParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryParameters; + })(); + + v3beta1.QueryInput = (function() { + + /** + * Properties of a QueryInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IQueryInput + * @property {google.cloud.dialogflow.cx.v3beta1.ITextInput|null} [text] QueryInput text + * @property {google.cloud.dialogflow.cx.v3beta1.IIntentInput|null} [intent] QueryInput intent + * @property {google.cloud.dialogflow.cx.v3beta1.IAudioInput|null} [audio] QueryInput audio + * @property {google.cloud.dialogflow.cx.v3beta1.IEventInput|null} [event] QueryInput event + * @property {google.cloud.dialogflow.cx.v3beta1.IDtmfInput|null} [dtmf] QueryInput dtmf + * @property {string|null} [languageCode] QueryInput languageCode + */ + + /** + * Constructs a new QueryInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a QueryInput. + * @implements IQueryInput + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryInput=} [properties] Properties to set + */ + function QueryInput(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]]; + } + + /** + * QueryInput text. + * @member {google.cloud.dialogflow.cx.v3beta1.ITextInput|null|undefined} text + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + QueryInput.prototype.text = null; + + /** + * QueryInput intent. + * @member {google.cloud.dialogflow.cx.v3beta1.IIntentInput|null|undefined} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + QueryInput.prototype.intent = null; + + /** + * QueryInput audio. + * @member {google.cloud.dialogflow.cx.v3beta1.IAudioInput|null|undefined} audio + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + QueryInput.prototype.audio = null; + + /** + * QueryInput event. + * @member {google.cloud.dialogflow.cx.v3beta1.IEventInput|null|undefined} event + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + QueryInput.prototype.event = null; + + /** + * QueryInput dtmf. + * @member {google.cloud.dialogflow.cx.v3beta1.IDtmfInput|null|undefined} dtmf + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + QueryInput.prototype.dtmf = null; + + /** + * QueryInput languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + QueryInput.prototype.languageCode = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryInput input. + * @member {"text"|"intent"|"audio"|"event"|"dtmf"|undefined} input + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + */ + Object.defineProperty(QueryInput.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["text", "intent", "audio", "event", "dtmf"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryInput} QueryInput instance + */ + QueryInput.create = function create(properties) { + return new QueryInput(properties); + }; + + /** + * Encodes the specified QueryInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryInput} message QueryInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.cx.v3beta1.TextInput.encode(message.text, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.cx.v3beta1.IntentInput.encode(message.intent, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + $root.google.cloud.dialogflow.cx.v3beta1.AudioInput.encode(message.audio, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.google.cloud.dialogflow.cx.v3beta1.EventInput.encode(message.event, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.dtmf != null && Object.hasOwnProperty.call(message, "dtmf")) + $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput.encode(message.dtmf, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryInput} message QueryInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @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.QueryInput} QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInput.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.QueryInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.text = $root.google.cloud.dialogflow.cx.v3beta1.TextInput.decode(reader, reader.uint32()); + break; + case 3: + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.IntentInput.decode(reader, reader.uint32()); + break; + case 5: + message.audio = $root.google.cloud.dialogflow.cx.v3beta1.AudioInput.decode(reader, reader.uint32()); + break; + case 6: + message.event = $root.google.cloud.dialogflow.cx.v3beta1.EventInput.decode(reader, reader.uint32()); + break; + case 7: + message.dtmf = $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput.decode(reader, reader.uint32()); + break; + case 4: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryInput} QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryInput message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TextInput.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.intent != null && message.hasOwnProperty("intent")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.IntentInput.verify(message.intent); + if (error) + return "intent." + error; + } + } + if (message.audio != null && message.hasOwnProperty("audio")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.AudioInput.verify(message.audio); + if (error) + return "audio." + error; + } + } + if (message.event != null && message.hasOwnProperty("event")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EventInput.verify(message.event); + if (error) + return "event." + error; + } + } + if (message.dtmf != null && message.hasOwnProperty("dtmf")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput.verify(message.dtmf); + if (error) + return "dtmf." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a QueryInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryInput} QueryInput + */ + QueryInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.QueryInput) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.QueryInput(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryInput.text: object expected"); + message.text = $root.google.cloud.dialogflow.cx.v3beta1.TextInput.fromObject(object.text); + } + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryInput.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.IntentInput.fromObject(object.intent); + } + if (object.audio != null) { + if (typeof object.audio !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryInput.audio: object expected"); + message.audio = $root.google.cloud.dialogflow.cx.v3beta1.AudioInput.fromObject(object.audio); + } + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryInput.event: object expected"); + message.event = $root.google.cloud.dialogflow.cx.v3beta1.EventInput.fromObject(object.event); + } + if (object.dtmf != null) { + if (typeof object.dtmf !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryInput.dtmf: object expected"); + message.dtmf = $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput.fromObject(object.dtmf); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a QueryInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.QueryInput} message QueryInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.languageCode = ""; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.cx.v3beta1.TextInput.toObject(message.text, options); + if (options.oneofs) + object.input = "text"; + } + if (message.intent != null && message.hasOwnProperty("intent")) { + object.intent = $root.google.cloud.dialogflow.cx.v3beta1.IntentInput.toObject(message.intent, options); + if (options.oneofs) + object.input = "intent"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.audio != null && message.hasOwnProperty("audio")) { + object.audio = $root.google.cloud.dialogflow.cx.v3beta1.AudioInput.toObject(message.audio, options); + if (options.oneofs) + object.input = "audio"; + } + if (message.event != null && message.hasOwnProperty("event")) { + object.event = $root.google.cloud.dialogflow.cx.v3beta1.EventInput.toObject(message.event, options); + if (options.oneofs) + object.input = "event"; + } + if (message.dtmf != null && message.hasOwnProperty("dtmf")) { + object.dtmf = $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput.toObject(message.dtmf, options); + if (options.oneofs) + object.input = "dtmf"; + } + return object; + }; + + /** + * Converts this QueryInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryInput + * @instance + * @returns {Object.} JSON object + */ + QueryInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryInput; + })(); + + v3beta1.QueryResult = (function() { + + /** + * Properties of a QueryResult. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IQueryResult + * @property {string|null} [text] QueryResult text + * @property {string|null} [triggerIntent] QueryResult triggerIntent + * @property {string|null} [transcript] QueryResult transcript + * @property {string|null} [triggerEvent] QueryResult triggerEvent + * @property {string|null} [languageCode] QueryResult languageCode + * @property {google.protobuf.IStruct|null} [parameters] QueryResult parameters + * @property {Array.|null} [responseMessages] QueryResult responseMessages + * @property {Array.|null} [webhookStatuses] QueryResult webhookStatuses + * @property {Array.|null} [webhookPayloads] QueryResult webhookPayloads + * @property {google.cloud.dialogflow.cx.v3beta1.IPage|null} [currentPage] QueryResult currentPage + * @property {google.cloud.dialogflow.cx.v3beta1.IIntent|null} [intent] QueryResult intent + * @property {number|null} [intentDetectionConfidence] QueryResult intentDetectionConfidence + * @property {google.cloud.dialogflow.cx.v3beta1.IMatch|null} [match] QueryResult match + * @property {google.protobuf.IStruct|null} [diagnosticInfo] QueryResult diagnosticInfo + * @property {google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult|null} [sentimentAnalysisResult] QueryResult sentimentAnalysisResult + */ + + /** + * Constructs a new QueryResult. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a QueryResult. + * @implements IQueryResult + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryResult=} [properties] Properties to set + */ + function QueryResult(properties) { + this.responseMessages = []; + this.webhookStatuses = []; + this.webhookPayloads = []; + 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]]; + } + + /** + * QueryResult text. + * @member {string} text + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.text = ""; + + /** + * QueryResult triggerIntent. + * @member {string} triggerIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.triggerIntent = ""; + + /** + * QueryResult transcript. + * @member {string} transcript + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.transcript = ""; + + /** + * QueryResult triggerEvent. + * @member {string} triggerEvent + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.triggerEvent = ""; + + /** + * QueryResult languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.languageCode = ""; + + /** + * QueryResult parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.parameters = null; + + /** + * QueryResult responseMessages. + * @member {Array.} responseMessages + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.responseMessages = $util.emptyArray; + + /** + * QueryResult webhookStatuses. + * @member {Array.} webhookStatuses + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.webhookStatuses = $util.emptyArray; + + /** + * QueryResult webhookPayloads. + * @member {Array.} webhookPayloads + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.webhookPayloads = $util.emptyArray; + + /** + * QueryResult currentPage. + * @member {google.cloud.dialogflow.cx.v3beta1.IPage|null|undefined} currentPage + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.currentPage = null; + + /** + * QueryResult intent. + * @member {google.cloud.dialogflow.cx.v3beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.intent = null; + + /** + * QueryResult intentDetectionConfidence. + * @member {number} intentDetectionConfidence + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.intentDetectionConfidence = 0; + + /** + * QueryResult match. + * @member {google.cloud.dialogflow.cx.v3beta1.IMatch|null|undefined} match + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.match = null; + + /** + * QueryResult diagnosticInfo. + * @member {google.protobuf.IStruct|null|undefined} diagnosticInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.diagnosticInfo = null; + + /** + * QueryResult sentimentAnalysisResult. + * @member {google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult|null|undefined} sentimentAnalysisResult + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + QueryResult.prototype.sentimentAnalysisResult = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryResult query. + * @member {"text"|"triggerIntent"|"transcript"|"triggerEvent"|undefined} query + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + */ + Object.defineProperty(QueryResult.prototype, "query", { + get: $util.oneOfGetter($oneOfFields = ["text", "triggerIntent", "transcript", "triggerEvent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryResult} QueryResult instance + */ + QueryResult.create = function create(properties) { + return new QueryResult(properties); + }; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.responseMessages != null && message.responseMessages.length) + for (var i = 0; i < message.responseMessages.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.encode(message.responseMessages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.webhookPayloads != null && message.webhookPayloads.length) + for (var i = 0; i < message.webhookPayloads.length; ++i) + $root.google.protobuf.Struct.encode(message.webhookPayloads[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.currentPage != null && Object.hasOwnProperty.call(message, "currentPage")) + $root.google.cloud.dialogflow.cx.v3beta1.Page.encode(message.currentPage, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.encode(message.intent, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.intentDetectionConfidence != null && Object.hasOwnProperty.call(message, "intentDetectionConfidence")) + writer.uint32(/* id 9, wireType 5 =*/77).float(message.intentDetectionConfidence); + if (message.diagnosticInfo != null && Object.hasOwnProperty.call(message, "diagnosticInfo")) + $root.google.protobuf.Struct.encode(message.diagnosticInfo, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.triggerIntent != null && Object.hasOwnProperty.call(message, "triggerIntent")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.triggerIntent); + if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.transcript); + if (message.webhookStatuses != null && message.webhookStatuses.length) + for (var i = 0; i < message.webhookStatuses.length; ++i) + $root.google.rpc.Status.encode(message.webhookStatuses[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.triggerEvent != null && Object.hasOwnProperty.call(message, "triggerEvent")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.triggerEvent); + if (message.match != null && Object.hasOwnProperty.call(message, "match")) + $root.google.cloud.dialogflow.cx.v3beta1.Match.encode(message.match, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.sentimentAnalysisResult != null && Object.hasOwnProperty.call(message, "sentimentAnalysisResult")) + $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.encode(message.sentimentAnalysisResult, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.QueryResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @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.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.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.QueryResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + case 11: + message.triggerIntent = reader.string(); + break; + case 12: + message.transcript = reader.string(); + break; + case 14: + message.triggerEvent = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.responseMessages && message.responseMessages.length)) + message.responseMessages = []; + message.responseMessages.push($root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.decode(reader, reader.uint32())); + break; + case 13: + if (!(message.webhookStatuses && message.webhookStatuses.length)) + message.webhookStatuses = []; + message.webhookStatuses.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.webhookPayloads && message.webhookPayloads.length)) + message.webhookPayloads = []; + message.webhookPayloads.push($root.google.protobuf.Struct.decode(reader, reader.uint32())); + break; + case 7: + message.currentPage = $root.google.cloud.dialogflow.cx.v3beta1.Page.decode(reader, reader.uint32()); + break; + case 8: + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.decode(reader, reader.uint32()); + break; + case 9: + message.intentDetectionConfidence = reader.float(); + break; + case 15: + message.match = $root.google.cloud.dialogflow.cx.v3beta1.Match.decode(reader, reader.uint32()); + break; + case 10: + message.diagnosticInfo = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 17: + message.sentimentAnalysisResult = $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryResult message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.query = 1; + if (!$util.isString(message.text)) + return "text: string expected"; + } + if (message.triggerIntent != null && message.hasOwnProperty("triggerIntent")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.triggerIntent)) + return "triggerIntent: string expected"; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.transcript)) + return "transcript: string expected"; + } + if (message.triggerEvent != null && message.hasOwnProperty("triggerEvent")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.triggerEvent)) + return "triggerEvent: string expected"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.responseMessages != null && message.hasOwnProperty("responseMessages")) { + if (!Array.isArray(message.responseMessages)) + return "responseMessages: array expected"; + for (var i = 0; i < message.responseMessages.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify(message.responseMessages[i]); + if (error) + return "responseMessages." + error; + } + } + if (message.webhookStatuses != null && message.hasOwnProperty("webhookStatuses")) { + if (!Array.isArray(message.webhookStatuses)) + return "webhookStatuses: array expected"; + for (var i = 0; i < message.webhookStatuses.length; ++i) { + var error = $root.google.rpc.Status.verify(message.webhookStatuses[i]); + if (error) + return "webhookStatuses." + error; + } + } + if (message.webhookPayloads != null && message.hasOwnProperty("webhookPayloads")) { + if (!Array.isArray(message.webhookPayloads)) + return "webhookPayloads: array expected"; + for (var i = 0; i < message.webhookPayloads.length; ++i) { + var error = $root.google.protobuf.Struct.verify(message.webhookPayloads[i]); + if (error) + return "webhookPayloads." + error; + } + } + if (message.currentPage != null && message.hasOwnProperty("currentPage")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Page.verify(message.currentPage); + if (error) + return "currentPage." + error; + } + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.intentDetectionConfidence != null && message.hasOwnProperty("intentDetectionConfidence")) + if (typeof message.intentDetectionConfidence !== "number") + return "intentDetectionConfidence: number expected"; + if (message.match != null && message.hasOwnProperty("match")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Match.verify(message.match); + if (error) + return "match." + error; + } + if (message.diagnosticInfo != null && message.hasOwnProperty("diagnosticInfo")) { + var error = $root.google.protobuf.Struct.verify(message.diagnosticInfo); + if (error) + return "diagnosticInfo." + error; + } + if (message.sentimentAnalysisResult != null && message.hasOwnProperty("sentimentAnalysisResult")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.verify(message.sentimentAnalysisResult); + if (error) + return "sentimentAnalysisResult." + error; + } + return null; + }; + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.QueryResult} QueryResult + */ + QueryResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.QueryResult) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.QueryResult(); + if (object.text != null) + message.text = String(object.text); + if (object.triggerIntent != null) + message.triggerIntent = String(object.triggerIntent); + if (object.transcript != null) + message.transcript = String(object.transcript); + if (object.triggerEvent != null) + message.triggerEvent = String(object.triggerEvent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.responseMessages) { + if (!Array.isArray(object.responseMessages)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.responseMessages: array expected"); + message.responseMessages = []; + for (var i = 0; i < object.responseMessages.length; ++i) { + if (typeof object.responseMessages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.responseMessages: object expected"); + message.responseMessages[i] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.fromObject(object.responseMessages[i]); + } + } + if (object.webhookStatuses) { + if (!Array.isArray(object.webhookStatuses)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.webhookStatuses: array expected"); + message.webhookStatuses = []; + for (var i = 0; i < object.webhookStatuses.length; ++i) { + if (typeof object.webhookStatuses[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.webhookStatuses: object expected"); + message.webhookStatuses[i] = $root.google.rpc.Status.fromObject(object.webhookStatuses[i]); + } + } + if (object.webhookPayloads) { + if (!Array.isArray(object.webhookPayloads)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.webhookPayloads: array expected"); + message.webhookPayloads = []; + for (var i = 0; i < object.webhookPayloads.length; ++i) { + if (typeof object.webhookPayloads[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.webhookPayloads: object expected"); + message.webhookPayloads[i] = $root.google.protobuf.Struct.fromObject(object.webhookPayloads[i]); + } + } + if (object.currentPage != null) { + if (typeof object.currentPage !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.currentPage: object expected"); + message.currentPage = $root.google.cloud.dialogflow.cx.v3beta1.Page.fromObject(object.currentPage); + } + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.fromObject(object.intent); + } + if (object.intentDetectionConfidence != null) + message.intentDetectionConfidence = Number(object.intentDetectionConfidence); + if (object.match != null) { + if (typeof object.match !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.match: object expected"); + message.match = $root.google.cloud.dialogflow.cx.v3beta1.Match.fromObject(object.match); + } + if (object.diagnosticInfo != null) { + if (typeof object.diagnosticInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.diagnosticInfo: object expected"); + message.diagnosticInfo = $root.google.protobuf.Struct.fromObject(object.diagnosticInfo); + } + if (object.sentimentAnalysisResult != null) { + if (typeof object.sentimentAnalysisResult !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.QueryResult.sentimentAnalysisResult: object expected"); + message.sentimentAnalysisResult = $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.fromObject(object.sentimentAnalysisResult); + } + return message; + }; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.QueryResult} message QueryResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.responseMessages = []; + object.webhookPayloads = []; + object.webhookStatuses = []; + } + if (options.defaults) { + object.languageCode = ""; + object.parameters = null; + object.currentPage = null; + object.intent = null; + object.intentDetectionConfidence = 0; + object.diagnosticInfo = null; + object.match = null; + object.sentimentAnalysisResult = null; + } + if (message.text != null && message.hasOwnProperty("text")) { + object.text = message.text; + if (options.oneofs) + object.query = "text"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.responseMessages && message.responseMessages.length) { + object.responseMessages = []; + for (var j = 0; j < message.responseMessages.length; ++j) + object.responseMessages[j] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.toObject(message.responseMessages[j], options); + } + if (message.webhookPayloads && message.webhookPayloads.length) { + object.webhookPayloads = []; + for (var j = 0; j < message.webhookPayloads.length; ++j) + object.webhookPayloads[j] = $root.google.protobuf.Struct.toObject(message.webhookPayloads[j], options); + } + if (message.currentPage != null && message.hasOwnProperty("currentPage")) + object.currentPage = $root.google.cloud.dialogflow.cx.v3beta1.Page.toObject(message.currentPage, options); + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.toObject(message.intent, options); + if (message.intentDetectionConfidence != null && message.hasOwnProperty("intentDetectionConfidence")) + object.intentDetectionConfidence = options.json && !isFinite(message.intentDetectionConfidence) ? String(message.intentDetectionConfidence) : message.intentDetectionConfidence; + if (message.diagnosticInfo != null && message.hasOwnProperty("diagnosticInfo")) + object.diagnosticInfo = $root.google.protobuf.Struct.toObject(message.diagnosticInfo, options); + if (message.triggerIntent != null && message.hasOwnProperty("triggerIntent")) { + object.triggerIntent = message.triggerIntent; + if (options.oneofs) + object.query = "triggerIntent"; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) { + object.transcript = message.transcript; + if (options.oneofs) + object.query = "transcript"; + } + if (message.webhookStatuses && message.webhookStatuses.length) { + object.webhookStatuses = []; + for (var j = 0; j < message.webhookStatuses.length; ++j) + object.webhookStatuses[j] = $root.google.rpc.Status.toObject(message.webhookStatuses[j], options); + } + if (message.triggerEvent != null && message.hasOwnProperty("triggerEvent")) { + object.triggerEvent = message.triggerEvent; + if (options.oneofs) + object.query = "triggerEvent"; + } + if (message.match != null && message.hasOwnProperty("match")) + object.match = $root.google.cloud.dialogflow.cx.v3beta1.Match.toObject(message.match, options); + if (message.sentimentAnalysisResult != null && message.hasOwnProperty("sentimentAnalysisResult")) + object.sentimentAnalysisResult = $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.toObject(message.sentimentAnalysisResult, options); + return object; + }; + + /** + * Converts this QueryResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.QueryResult + * @instance + * @returns {Object.} JSON object + */ + QueryResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QueryResult; + })(); + + v3beta1.TextInput = (function() { + + /** + * Properties of a TextInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ITextInput + * @property {string|null} [text] TextInput text + */ + + /** + * Constructs a new TextInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a TextInput. + * @implements ITextInput + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ITextInput=} [properties] Properties to set + */ + function TextInput(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]]; + } + + /** + * TextInput text. + * @member {string} text + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @instance + */ + TextInput.prototype.text = ""; + + /** + * Creates a new TextInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITextInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.TextInput} TextInput instance + */ + TextInput.create = function create(properties) { + return new TextInput(properties); + }; + + /** + * Encodes the specified TextInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TextInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITextInput} message TextInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + return writer; + }; + + /** + * Encodes the specified TextInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TextInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITextInput} message TextInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @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.TextInput} TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextInput.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.TextInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.TextInput} TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextInput message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a TextInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.TextInput} TextInput + */ + TextInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.TextInput) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.TextInput(); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a TextInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.TextInput} message TextInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this TextInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.TextInput + * @instance + * @returns {Object.} JSON object + */ + TextInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextInput; + })(); + + v3beta1.IntentInput = (function() { + + /** + * Properties of an IntentInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IIntentInput + * @property {string|null} [intent] IntentInput intent + */ + + /** + * Constructs a new IntentInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an IntentInput. + * @implements IIntentInput + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IIntentInput=} [properties] Properties to set + */ + function IntentInput(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]]; + } + + /** + * IntentInput intent. + * @member {string} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @instance + */ + IntentInput.prototype.intent = ""; + + /** + * Creates a new IntentInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IIntentInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.IntentInput} IntentInput instance + */ + IntentInput.create = function create(properties) { + return new IntentInput(properties); + }; + + /** + * Encodes the specified IntentInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.IntentInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IIntentInput} message IntentInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.intent); + return writer; + }; + + /** + * Encodes the specified IntentInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.IntentInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IIntentInput} message IntentInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IntentInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @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.IntentInput} IntentInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentInput.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.IntentInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.intent = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IntentInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.IntentInput} IntentInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IntentInput message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IntentInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intent != null && message.hasOwnProperty("intent")) + if (!$util.isString(message.intent)) + return "intent: string expected"; + return null; + }; + + /** + * Creates an IntentInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.IntentInput} IntentInput + */ + IntentInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.IntentInput) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.IntentInput(); + if (object.intent != null) + message.intent = String(object.intent); + return message; + }; + + /** + * Creates a plain object from an IntentInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IntentInput} message IntentInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IntentInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.intent = ""; + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = message.intent; + return object; + }; + + /** + * Converts this IntentInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.IntentInput + * @instance + * @returns {Object.} JSON object + */ + IntentInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IntentInput; + })(); + + v3beta1.AudioInput = (function() { + + /** + * Properties of an AudioInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IAudioInput + * @property {google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig|null} [config] AudioInput config + * @property {Uint8Array|null} [audio] AudioInput audio + */ + + /** + * Constructs a new AudioInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an AudioInput. + * @implements IAudioInput + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IAudioInput=} [properties] Properties to set + */ + function AudioInput(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]]; + } + + /** + * AudioInput config. + * @member {google.cloud.dialogflow.cx.v3beta1.IInputAudioConfig|null|undefined} config + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @instance + */ + AudioInput.prototype.config = null; + + /** + * AudioInput audio. + * @member {Uint8Array} audio + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @instance + */ + AudioInput.prototype.audio = $util.newBuffer([]); + + /** + * Creates a new AudioInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IAudioInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.AudioInput} AudioInput instance + */ + AudioInput.create = function create(properties) { + return new AudioInput(properties); + }; + + /** + * Encodes the specified AudioInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.AudioInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IAudioInput} message AudioInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AudioInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.config != null && Object.hasOwnProperty.call(message, "config")) + $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.encode(message.config, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.audio); + return writer; + }; + + /** + * Encodes the specified AudioInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.AudioInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IAudioInput} message AudioInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AudioInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AudioInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @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.AudioInput} AudioInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AudioInput.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.AudioInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.config = $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.decode(reader, reader.uint32()); + break; + case 2: + message.audio = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AudioInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.AudioInput} AudioInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AudioInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AudioInput message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AudioInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.config != null && message.hasOwnProperty("config")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.verify(message.config); + if (error) + return "config." + error; + } + if (message.audio != null && message.hasOwnProperty("audio")) + if (!(message.audio && typeof message.audio.length === "number" || $util.isString(message.audio))) + return "audio: buffer expected"; + return null; + }; + + /** + * Creates an AudioInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.AudioInput} AudioInput + */ + AudioInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.AudioInput) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.AudioInput(); + if (object.config != null) { + if (typeof object.config !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.AudioInput.config: object expected"); + message.config = $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.fromObject(object.config); + } + if (object.audio != null) + if (typeof object.audio === "string") + $util.base64.decode(object.audio, message.audio = $util.newBuffer($util.base64.length(object.audio)), 0); + else if (object.audio.length) + message.audio = object.audio; + return message; + }; + + /** + * Creates a plain object from an AudioInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.AudioInput} message AudioInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AudioInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.config = null; + if (options.bytes === String) + object.audio = ""; + else { + object.audio = []; + if (options.bytes !== Array) + object.audio = $util.newBuffer(object.audio); + } + } + if (message.config != null && message.hasOwnProperty("config")) + object.config = $root.google.cloud.dialogflow.cx.v3beta1.InputAudioConfig.toObject(message.config, options); + if (message.audio != null && message.hasOwnProperty("audio")) + object.audio = options.bytes === String ? $util.base64.encode(message.audio, 0, message.audio.length) : options.bytes === Array ? Array.prototype.slice.call(message.audio) : message.audio; + return object; + }; + + /** + * Converts this AudioInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.AudioInput + * @instance + * @returns {Object.} JSON object + */ + AudioInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AudioInput; + })(); + + v3beta1.EventInput = (function() { + + /** + * Properties of an EventInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IEventInput + * @property {string|null} [event] EventInput event + */ + + /** + * Constructs a new EventInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an EventInput. + * @implements IEventInput + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IEventInput=} [properties] Properties to set + */ + function EventInput(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]]; + } + + /** + * EventInput event. + * @member {string} event + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @instance + */ + EventInput.prototype.event = ""; + + /** + * Creates a new EventInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEventInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.EventInput} EventInput instance + */ + EventInput.create = function create(properties) { + return new EventInput(properties); + }; + + /** + * Encodes the specified EventInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEventInput} message EventInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.event); + return writer; + }; + + /** + * Encodes the specified EventInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.EventInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IEventInput} message EventInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @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.EventInput} EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventInput.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.EventInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.event = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.EventInput} EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventInput message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.event != null && message.hasOwnProperty("event")) + if (!$util.isString(message.event)) + return "event: string expected"; + return null; + }; + + /** + * Creates an EventInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.EventInput} EventInput + */ + EventInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.EventInput) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.EventInput(); + if (object.event != null) + message.event = String(object.event); + return message; + }; + + /** + * Creates a plain object from an EventInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.EventInput} message EventInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.event = ""; + if (message.event != null && message.hasOwnProperty("event")) + object.event = message.event; + return object; + }; + + /** + * Converts this EventInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.EventInput + * @instance + * @returns {Object.} JSON object + */ + EventInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EventInput; + })(); + + v3beta1.DtmfInput = (function() { + + /** + * Properties of a DtmfInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDtmfInput + * @property {string|null} [digits] DtmfInput digits + * @property {string|null} [finishDigit] DtmfInput finishDigit + */ + + /** + * Constructs a new DtmfInput. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DtmfInput. + * @implements IDtmfInput + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDtmfInput=} [properties] Properties to set + */ + function DtmfInput(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]]; + } + + /** + * DtmfInput digits. + * @member {string} digits + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @instance + */ + DtmfInput.prototype.digits = ""; + + /** + * DtmfInput finishDigit. + * @member {string} finishDigit + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @instance + */ + DtmfInput.prototype.finishDigit = ""; + + /** + * Creates a new DtmfInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDtmfInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DtmfInput} DtmfInput instance + */ + DtmfInput.create = function create(properties) { + return new DtmfInput(properties); + }; + + /** + * Encodes the specified DtmfInput message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DtmfInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDtmfInput} message DtmfInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DtmfInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.digits != null && Object.hasOwnProperty.call(message, "digits")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.digits); + if (message.finishDigit != null && Object.hasOwnProperty.call(message, "finishDigit")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.finishDigit); + return writer; + }; + + /** + * Encodes the specified DtmfInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DtmfInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDtmfInput} message DtmfInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DtmfInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DtmfInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @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.DtmfInput} DtmfInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DtmfInput.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.DtmfInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.digits = reader.string(); + break; + case 2: + message.finishDigit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DtmfInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DtmfInput} DtmfInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DtmfInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DtmfInput message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DtmfInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.digits != null && message.hasOwnProperty("digits")) + if (!$util.isString(message.digits)) + return "digits: string expected"; + if (message.finishDigit != null && message.hasOwnProperty("finishDigit")) + if (!$util.isString(message.finishDigit)) + return "finishDigit: string expected"; + return null; + }; + + /** + * Creates a DtmfInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DtmfInput} DtmfInput + */ + DtmfInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DtmfInput(); + if (object.digits != null) + message.digits = String(object.digits); + if (object.finishDigit != null) + message.finishDigit = String(object.finishDigit); + return message; + }; + + /** + * Creates a plain object from a DtmfInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DtmfInput} message DtmfInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DtmfInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.digits = ""; + object.finishDigit = ""; + } + if (message.digits != null && message.hasOwnProperty("digits")) + object.digits = message.digits; + if (message.finishDigit != null && message.hasOwnProperty("finishDigit")) + object.finishDigit = message.finishDigit; + return object; + }; + + /** + * Converts this DtmfInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DtmfInput + * @instance + * @returns {Object.} JSON object + */ + DtmfInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DtmfInput; + })(); + + v3beta1.Match = (function() { + + /** + * Properties of a Match. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IMatch + * @property {google.cloud.dialogflow.cx.v3beta1.IIntent|null} [intent] Match intent + * @property {string|null} [event] Match event + * @property {google.protobuf.IStruct|null} [parameters] Match parameters + * @property {string|null} [resolvedInput] Match resolvedInput + * @property {google.cloud.dialogflow.cx.v3beta1.Match.MatchType|null} [matchType] Match matchType + * @property {number|null} [confidence] Match confidence + */ + + /** + * Constructs a new Match. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Match. + * @implements IMatch + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IMatch=} [properties] Properties to set + */ + function Match(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]]; + } + + /** + * Match intent. + * @member {google.cloud.dialogflow.cx.v3beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + */ + Match.prototype.intent = null; + + /** + * Match event. + * @member {string} event + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + */ + Match.prototype.event = ""; + + /** + * Match parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + */ + Match.prototype.parameters = null; + + /** + * Match resolvedInput. + * @member {string} resolvedInput + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + */ + Match.prototype.resolvedInput = ""; + + /** + * Match matchType. + * @member {google.cloud.dialogflow.cx.v3beta1.Match.MatchType} matchType + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + */ + Match.prototype.matchType = 0; + + /** + * Match confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + */ + Match.prototype.confidence = 0; + + /** + * Creates a new Match instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatch=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Match} Match instance + */ + Match.create = function create(properties) { + return new Match(properties); + }; + + /** + * Encodes the specified Match message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Match.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatch} message Match message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Match.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.cx.v3beta1.Intent.encode(message.intent, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.resolvedInput != null && Object.hasOwnProperty.call(message, "resolvedInput")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.resolvedInput); + if (message.matchType != null && Object.hasOwnProperty.call(message, "matchType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.matchType); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.event); + return writer; + }; + + /** + * Encodes the specified Match message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Match.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatch} message Match message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Match.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Match message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @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.Match} Match + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Match.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.Match(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.decode(reader, reader.uint32()); + break; + case 6: + message.event = reader.string(); + break; + case 2: + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 3: + message.resolvedInput = reader.string(); + break; + case 4: + message.matchType = reader.int32(); + break; + case 5: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Match message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Match} Match + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Match.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Match message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Match.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.event != null && message.hasOwnProperty("event")) + if (!$util.isString(message.event)) + return "event: string expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.resolvedInput != null && message.hasOwnProperty("resolvedInput")) + if (!$util.isString(message.resolvedInput)) + return "resolvedInput: string expected"; + if (message.matchType != null && message.hasOwnProperty("matchType")) + switch (message.matchType) { + default: + return "matchType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a Match message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Match} Match + */ + Match.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Match) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Match(); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Match.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.fromObject(object.intent); + } + if (object.event != null) + message.event = String(object.event); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Match.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.resolvedInput != null) + message.resolvedInput = String(object.resolvedInput); + switch (object.matchType) { + case "MATCH_TYPE_UNSPECIFIED": + case 0: + message.matchType = 0; + break; + case "INTENT": + case 1: + message.matchType = 1; + break; + case "DIRECT_INTENT": + case 2: + message.matchType = 2; + break; + case "PARAMETER_FILLING": + case 3: + message.matchType = 3; + break; + case "NO_MATCH": + case 4: + message.matchType = 4; + break; + case "NO_INPUT": + case 5: + message.matchType = 5; + break; + case "EVENT": + case 6: + message.matchType = 6; + break; + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a Match message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Match} message Match + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Match.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.intent = null; + object.parameters = null; + object.resolvedInput = ""; + object.matchType = options.enums === String ? "MATCH_TYPE_UNSPECIFIED" : 0; + object.confidence = 0; + object.event = ""; + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.cx.v3beta1.Intent.toObject(message.intent, options); + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.resolvedInput != null && message.hasOwnProperty("resolvedInput")) + object.resolvedInput = message.resolvedInput; + if (message.matchType != null && message.hasOwnProperty("matchType")) + object.matchType = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.Match.MatchType[message.matchType] : message.matchType; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.event != null && message.hasOwnProperty("event")) + object.event = message.event; + return object; + }; + + /** + * Converts this Match to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Match + * @instance + * @returns {Object.} JSON object + */ + Match.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * MatchType enum. + * @name google.cloud.dialogflow.cx.v3beta1.Match.MatchType + * @enum {number} + * @property {number} MATCH_TYPE_UNSPECIFIED=0 MATCH_TYPE_UNSPECIFIED value + * @property {number} INTENT=1 INTENT value + * @property {number} DIRECT_INTENT=2 DIRECT_INTENT value + * @property {number} PARAMETER_FILLING=3 PARAMETER_FILLING value + * @property {number} NO_MATCH=4 NO_MATCH value + * @property {number} NO_INPUT=5 NO_INPUT value + * @property {number} EVENT=6 EVENT value + */ + Match.MatchType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MATCH_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INTENT"] = 1; + values[valuesById[2] = "DIRECT_INTENT"] = 2; + values[valuesById[3] = "PARAMETER_FILLING"] = 3; + values[valuesById[4] = "NO_MATCH"] = 4; + values[valuesById[5] = "NO_INPUT"] = 5; + values[valuesById[6] = "EVENT"] = 6; + return values; + })(); + + return Match; + })(); + + v3beta1.MatchIntentRequest = (function() { + + /** + * Properties of a MatchIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IMatchIntentRequest + * @property {string|null} [session] MatchIntentRequest session + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null} [queryParams] MatchIntentRequest queryParams + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryInput|null} [queryInput] MatchIntentRequest queryInput + */ + + /** + * Constructs a new MatchIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a MatchIntentRequest. + * @implements IMatchIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest=} [properties] Properties to set + */ + function MatchIntentRequest(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]]; + } + + /** + * MatchIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @instance + */ + MatchIntentRequest.prototype.session = ""; + + /** + * MatchIntentRequest queryParams. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @instance + */ + MatchIntentRequest.prototype.queryParams = null; + + /** + * MatchIntentRequest queryInput. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @instance + */ + MatchIntentRequest.prototype.queryInput = null; + + /** + * Creates a new MatchIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest} MatchIntentRequest instance + */ + MatchIntentRequest.create = function create(properties) { + return new MatchIntentRequest(properties); + }; + + /** + * Encodes the specified MatchIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest} message MatchIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MatchIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MatchIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest} message MatchIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MatchIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MatchIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @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.MatchIntentRequest} MatchIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MatchIntentRequest.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.MatchIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.session = reader.string(); + break; + case 2: + message.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.decode(reader, reader.uint32()); + break; + case 3: + message.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MatchIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest} MatchIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MatchIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MatchIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MatchIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + return null; + }; + + /** + * Creates a MatchIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest} MatchIntentRequest + */ + MatchIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.fromObject(object.queryInput); + } + return message; + }; + + /** + * Creates a plain object from a MatchIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest} message MatchIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MatchIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.cx.v3beta1.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.cx.v3beta1.QueryInput.toObject(message.queryInput, options); + return object; + }; + + /** + * Converts this MatchIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest + * @instance + * @returns {Object.} JSON object + */ + MatchIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MatchIntentRequest; + })(); + + v3beta1.MatchIntentResponse = (function() { + + /** + * Properties of a MatchIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IMatchIntentResponse + * @property {string|null} [text] MatchIntentResponse text + * @property {string|null} [triggerIntent] MatchIntentResponse triggerIntent + * @property {string|null} [transcript] MatchIntentResponse transcript + * @property {string|null} [triggerEvent] MatchIntentResponse triggerEvent + * @property {Array.|null} [matches] MatchIntentResponse matches + * @property {google.cloud.dialogflow.cx.v3beta1.IPage|null} [currentPage] MatchIntentResponse currentPage + */ + + /** + * Constructs a new MatchIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a MatchIntentResponse. + * @implements IMatchIntentResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse=} [properties] Properties to set + */ + function MatchIntentResponse(properties) { + this.matches = []; + 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]]; + } + + /** + * MatchIntentResponse text. + * @member {string} text + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + MatchIntentResponse.prototype.text = ""; + + /** + * MatchIntentResponse triggerIntent. + * @member {string} triggerIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + MatchIntentResponse.prototype.triggerIntent = ""; + + /** + * MatchIntentResponse transcript. + * @member {string} transcript + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + MatchIntentResponse.prototype.transcript = ""; + + /** + * MatchIntentResponse triggerEvent. + * @member {string} triggerEvent + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + MatchIntentResponse.prototype.triggerEvent = ""; + + /** + * MatchIntentResponse matches. + * @member {Array.} matches + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + MatchIntentResponse.prototype.matches = $util.emptyArray; + + /** + * MatchIntentResponse currentPage. + * @member {google.cloud.dialogflow.cx.v3beta1.IPage|null|undefined} currentPage + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + MatchIntentResponse.prototype.currentPage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * MatchIntentResponse query. + * @member {"text"|"triggerIntent"|"transcript"|"triggerEvent"|undefined} query + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + */ + Object.defineProperty(MatchIntentResponse.prototype, "query", { + get: $util.oneOfGetter($oneOfFields = ["text", "triggerIntent", "transcript", "triggerEvent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new MatchIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse} MatchIntentResponse instance + */ + MatchIntentResponse.create = function create(properties) { + return new MatchIntentResponse(properties); + }; + + /** + * Encodes the specified MatchIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse} message MatchIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MatchIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.triggerIntent != null && Object.hasOwnProperty.call(message, "triggerIntent")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.triggerIntent); + if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.transcript); + if (message.matches != null && message.matches.length) + for (var i = 0; i < message.matches.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Match.encode(message.matches[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.currentPage != null && Object.hasOwnProperty.call(message, "currentPage")) + $root.google.cloud.dialogflow.cx.v3beta1.Page.encode(message.currentPage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.triggerEvent != null && Object.hasOwnProperty.call(message, "triggerEvent")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.triggerEvent); + return writer; + }; + + /** + * Encodes the specified MatchIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse} message MatchIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MatchIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MatchIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @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.MatchIntentResponse} MatchIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MatchIntentResponse.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.MatchIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + case 2: + message.triggerIntent = reader.string(); + break; + case 3: + message.transcript = reader.string(); + break; + case 6: + message.triggerEvent = reader.string(); + break; + case 4: + if (!(message.matches && message.matches.length)) + message.matches = []; + message.matches.push($root.google.cloud.dialogflow.cx.v3beta1.Match.decode(reader, reader.uint32())); + break; + case 5: + message.currentPage = $root.google.cloud.dialogflow.cx.v3beta1.Page.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MatchIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse} MatchIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MatchIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MatchIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MatchIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.query = 1; + if (!$util.isString(message.text)) + return "text: string expected"; + } + if (message.triggerIntent != null && message.hasOwnProperty("triggerIntent")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.triggerIntent)) + return "triggerIntent: string expected"; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.transcript)) + return "transcript: string expected"; + } + if (message.triggerEvent != null && message.hasOwnProperty("triggerEvent")) { + if (properties.query === 1) + return "query: multiple values"; + properties.query = 1; + if (!$util.isString(message.triggerEvent)) + return "triggerEvent: string expected"; + } + if (message.matches != null && message.hasOwnProperty("matches")) { + if (!Array.isArray(message.matches)) + return "matches: array expected"; + for (var i = 0; i < message.matches.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Match.verify(message.matches[i]); + if (error) + return "matches." + error; + } + } + if (message.currentPage != null && message.hasOwnProperty("currentPage")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Page.verify(message.currentPage); + if (error) + return "currentPage." + error; + } + return null; + }; + + /** + * Creates a MatchIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse} MatchIntentResponse + */ + MatchIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse(); + if (object.text != null) + message.text = String(object.text); + if (object.triggerIntent != null) + message.triggerIntent = String(object.triggerIntent); + if (object.transcript != null) + message.transcript = String(object.transcript); + if (object.triggerEvent != null) + message.triggerEvent = String(object.triggerEvent); + if (object.matches) { + if (!Array.isArray(object.matches)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.matches: array expected"); + message.matches = []; + for (var i = 0; i < object.matches.length; ++i) { + if (typeof object.matches[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.matches: object expected"); + message.matches[i] = $root.google.cloud.dialogflow.cx.v3beta1.Match.fromObject(object.matches[i]); + } + } + if (object.currentPage != null) { + if (typeof object.currentPage !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse.currentPage: object expected"); + message.currentPage = $root.google.cloud.dialogflow.cx.v3beta1.Page.fromObject(object.currentPage); + } + return message; + }; + + /** + * Creates a plain object from a MatchIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse} message MatchIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MatchIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.matches = []; + if (options.defaults) + object.currentPage = null; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = message.text; + if (options.oneofs) + object.query = "text"; + } + if (message.triggerIntent != null && message.hasOwnProperty("triggerIntent")) { + object.triggerIntent = message.triggerIntent; + if (options.oneofs) + object.query = "triggerIntent"; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) { + object.transcript = message.transcript; + if (options.oneofs) + object.query = "transcript"; + } + if (message.matches && message.matches.length) { + object.matches = []; + for (var j = 0; j < message.matches.length; ++j) + object.matches[j] = $root.google.cloud.dialogflow.cx.v3beta1.Match.toObject(message.matches[j], options); + } + if (message.currentPage != null && message.hasOwnProperty("currentPage")) + object.currentPage = $root.google.cloud.dialogflow.cx.v3beta1.Page.toObject(message.currentPage, options); + if (message.triggerEvent != null && message.hasOwnProperty("triggerEvent")) { + object.triggerEvent = message.triggerEvent; + if (options.oneofs) + object.query = "triggerEvent"; + } + return object; + }; + + /** + * Converts this MatchIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse + * @instance + * @returns {Object.} JSON object + */ + MatchIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MatchIntentResponse; + })(); + + v3beta1.FulfillIntentRequest = (function() { + + /** + * Properties of a FulfillIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IFulfillIntentRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest|null} [matchIntentRequest] FulfillIntentRequest matchIntentRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IMatch|null} [match] FulfillIntentRequest match + * @property {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null} [outputAudioConfig] FulfillIntentRequest outputAudioConfig + */ + + /** + * Constructs a new FulfillIntentRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a FulfillIntentRequest. + * @implements IFulfillIntentRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest=} [properties] Properties to set + */ + function FulfillIntentRequest(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]]; + } + + /** + * FulfillIntentRequest matchIntentRequest. + * @member {google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest|null|undefined} matchIntentRequest + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @instance + */ + FulfillIntentRequest.prototype.matchIntentRequest = null; + + /** + * FulfillIntentRequest match. + * @member {google.cloud.dialogflow.cx.v3beta1.IMatch|null|undefined} match + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @instance + */ + FulfillIntentRequest.prototype.match = null; + + /** + * FulfillIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @instance + */ + FulfillIntentRequest.prototype.outputAudioConfig = null; + + /** + * Creates a new FulfillIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest} FulfillIntentRequest instance + */ + FulfillIntentRequest.create = function create(properties) { + return new FulfillIntentRequest(properties); + }; + + /** + * Encodes the specified FulfillIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest} message FulfillIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.matchIntentRequest != null && Object.hasOwnProperty.call(message, "matchIntentRequest")) + $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.encode(message.matchIntentRequest, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.match != null && Object.hasOwnProperty.call(message, "match")) + $root.google.cloud.dialogflow.cx.v3beta1.Match.encode(message.match, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FulfillIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest} message FulfillIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FulfillIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @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.FulfillIntentRequest} FulfillIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillIntentRequest.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.FulfillIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.matchIntentRequest = $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.decode(reader, reader.uint32()); + break; + case 2: + message.match = $root.google.cloud.dialogflow.cx.v3beta1.Match.decode(reader, reader.uint32()); + break; + case 3: + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FulfillIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest} FulfillIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FulfillIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FulfillIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.matchIntentRequest != null && message.hasOwnProperty("matchIntentRequest")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.verify(message.matchIntentRequest); + if (error) + return "matchIntentRequest." + error; + } + if (message.match != null && message.hasOwnProperty("match")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Match.verify(message.match); + if (error) + return "match." + error; + } + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a FulfillIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest} FulfillIntentRequest + */ + FulfillIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest(); + if (object.matchIntentRequest != null) { + if (typeof object.matchIntentRequest !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.matchIntentRequest: object expected"); + message.matchIntentRequest = $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.fromObject(object.matchIntentRequest); + } + if (object.match != null) { + if (typeof object.match !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.match: object expected"); + message.match = $root.google.cloud.dialogflow.cx.v3beta1.Match.fromObject(object.match); + } + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a FulfillIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest} message FulfillIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FulfillIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.matchIntentRequest = null; + object.match = null; + object.outputAudioConfig = null; + } + if (message.matchIntentRequest != null && message.hasOwnProperty("matchIntentRequest")) + object.matchIntentRequest = $root.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest.toObject(message.matchIntentRequest, options); + if (message.match != null && message.hasOwnProperty("match")) + object.match = $root.google.cloud.dialogflow.cx.v3beta1.Match.toObject(message.match, options); + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this FulfillIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest + * @instance + * @returns {Object.} JSON object + */ + FulfillIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FulfillIntentRequest; + })(); + + v3beta1.FulfillIntentResponse = (function() { + + /** + * Properties of a FulfillIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IFulfillIntentResponse + * @property {string|null} [responseId] FulfillIntentResponse responseId + * @property {google.cloud.dialogflow.cx.v3beta1.IQueryResult|null} [queryResult] FulfillIntentResponse queryResult + * @property {Uint8Array|null} [outputAudio] FulfillIntentResponse outputAudio + * @property {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null} [outputAudioConfig] FulfillIntentResponse outputAudioConfig + */ + + /** + * Constructs a new FulfillIntentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a FulfillIntentResponse. + * @implements IFulfillIntentResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse=} [properties] Properties to set + */ + function FulfillIntentResponse(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]]; + } + + /** + * FulfillIntentResponse responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @instance + */ + FulfillIntentResponse.prototype.responseId = ""; + + /** + * FulfillIntentResponse queryResult. + * @member {google.cloud.dialogflow.cx.v3beta1.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @instance + */ + FulfillIntentResponse.prototype.queryResult = null; + + /** + * FulfillIntentResponse outputAudio. + * @member {Uint8Array} outputAudio + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @instance + */ + FulfillIntentResponse.prototype.outputAudio = $util.newBuffer([]); + + /** + * FulfillIntentResponse outputAudioConfig. + * @member {google.cloud.dialogflow.cx.v3beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @instance + */ + FulfillIntentResponse.prototype.outputAudioConfig = null; + + /** + * Creates a new FulfillIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse} FulfillIntentResponse instance + */ + FulfillIntentResponse.create = function create(properties) { + return new FulfillIntentResponse(properties); + }; + + /** + * Encodes the specified FulfillIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse} message FulfillIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.encode(message.queryResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.outputAudio != null && Object.hasOwnProperty.call(message, "outputAudio")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.outputAudio); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FulfillIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse} message FulfillIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FulfillIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @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.FulfillIntentResponse} FulfillIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillIntentResponse.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.FulfillIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.responseId = reader.string(); + break; + case 2: + message.queryResult = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.decode(reader, reader.uint32()); + break; + case 3: + message.outputAudio = reader.bytes(); + break; + case 4: + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FulfillIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse} FulfillIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FulfillIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FulfillIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + if (!(message.outputAudio && typeof message.outputAudio.length === "number" || $util.isString(message.outputAudio))) + return "outputAudio: buffer expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a FulfillIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse} FulfillIntentResponse + */ + FulfillIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse(); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.fromObject(object.queryResult); + } + if (object.outputAudio != null) + if (typeof object.outputAudio === "string") + $util.base64.decode(object.outputAudio, message.outputAudio = $util.newBuffer($util.base64.length(object.outputAudio)), 0); + else if (object.outputAudio.length) + message.outputAudio = object.outputAudio; + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a FulfillIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse} message FulfillIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FulfillIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseId = ""; + object.queryResult = null; + if (options.bytes === String) + object.outputAudio = ""; + else { + object.outputAudio = []; + if (options.bytes !== Array) + object.outputAudio = $util.newBuffer(object.outputAudio); + } + object.outputAudioConfig = null; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.cx.v3beta1.QueryResult.toObject(message.queryResult, options); + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + object.outputAudio = options.bytes === String ? $util.base64.encode(message.outputAudio, 0, message.outputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.outputAudio) : message.outputAudio; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this FulfillIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse + * @instance + * @returns {Object.} JSON object + */ + FulfillIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FulfillIntentResponse; + })(); + + v3beta1.SentimentAnalysisResult = (function() { + + /** + * Properties of a SentimentAnalysisResult. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ISentimentAnalysisResult + * @property {number|null} [score] SentimentAnalysisResult score + * @property {number|null} [magnitude] SentimentAnalysisResult magnitude + */ + + /** + * Constructs a new SentimentAnalysisResult. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SentimentAnalysisResult. + * @implements ISentimentAnalysisResult + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult=} [properties] Properties to set + */ + function SentimentAnalysisResult(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]]; + } + + /** + * SentimentAnalysisResult score. + * @member {number} score + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @instance + */ + SentimentAnalysisResult.prototype.score = 0; + + /** + * SentimentAnalysisResult magnitude. + * @member {number} magnitude + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @instance + */ + SentimentAnalysisResult.prototype.magnitude = 0; + + /** + * Creates a new SentimentAnalysisResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult} SentimentAnalysisResult instance + */ + SentimentAnalysisResult.create = function create(properties) { + return new SentimentAnalysisResult(properties); + }; + + /** + * Encodes the specified SentimentAnalysisResult message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult} message SentimentAnalysisResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); + if (message.magnitude != null && Object.hasOwnProperty.call(message, "magnitude")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.magnitude); + return writer; + }; + + /** + * Encodes the specified SentimentAnalysisResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISentimentAnalysisResult} message SentimentAnalysisResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @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.SentimentAnalysisResult} SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisResult.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.SentimentAnalysisResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.score = reader.float(); + break; + case 2: + message.magnitude = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult} SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SentimentAnalysisResult message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SentimentAnalysisResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + if (typeof message.magnitude !== "number") + return "magnitude: number expected"; + return null; + }; + + /** + * Creates a SentimentAnalysisResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult} SentimentAnalysisResult + */ + SentimentAnalysisResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult(); + if (object.score != null) + message.score = Number(object.score); + if (object.magnitude != null) + message.magnitude = Number(object.magnitude); + return message; + }; + + /** + * Creates a plain object from a SentimentAnalysisResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult} message SentimentAnalysisResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SentimentAnalysisResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.score = 0; + object.magnitude = 0; + } + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + object.magnitude = options.json && !isFinite(message.magnitude) ? String(message.magnitude) : message.magnitude; + return object; + }; + + /** + * Converts this SentimentAnalysisResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.SentimentAnalysisResult + * @instance + * @returns {Object.} JSON object + */ + SentimentAnalysisResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SentimentAnalysisResult; + })(); + + v3beta1.SessionEntityTypes = (function() { + + /** + * Constructs a new SessionEntityTypes service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SessionEntityTypes + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SessionEntityTypes(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SessionEntityTypes.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SessionEntityTypes; + + /** + * Creates new SessionEntityTypes service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SessionEntityTypes} RPC service. Useful where requests and/or responses are streamed. + */ + SessionEntityTypes.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#listSessionEntityTypes}. + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @typedef ListSessionEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse} [response] ListSessionEntityTypesResponse + */ + + /** + * Calls ListSessionEntityTypes. + * @function listSessionEntityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest} request ListSessionEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.ListSessionEntityTypesCallback} callback Node-style callback called with the error, if any, and ListSessionEntityTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.listSessionEntityTypes = function listSessionEntityTypes(request, callback) { + return this.rpcCall(listSessionEntityTypes, $root.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse, request, callback); + }, "name", { value: "ListSessionEntityTypes" }); + + /** + * Calls ListSessionEntityTypes. + * @function listSessionEntityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest} request ListSessionEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#getSessionEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @typedef GetSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls GetSessionEntityType. + * @function getSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest} request GetSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.GetSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.getSessionEntityType = function getSessionEntityType(request, callback) { + return this.rpcCall(getSessionEntityType, $root.google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest, $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType, request, callback); + }, "name", { value: "GetSessionEntityType" }); + + /** + * Calls GetSessionEntityType. + * @function getSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest} request GetSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#createSessionEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @typedef CreateSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls CreateSessionEntityType. + * @function createSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest} request CreateSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.CreateSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.createSessionEntityType = function createSessionEntityType(request, callback) { + return this.rpcCall(createSessionEntityType, $root.google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest, $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType, request, callback); + }, "name", { value: "CreateSessionEntityType" }); + + /** + * Calls CreateSessionEntityType. + * @function createSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest} request CreateSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#updateSessionEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @typedef UpdateSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls UpdateSessionEntityType. + * @function updateSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest} request UpdateSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.UpdateSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.updateSessionEntityType = function updateSessionEntityType(request, callback) { + return this.rpcCall(updateSessionEntityType, $root.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest, $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType, request, callback); + }, "name", { value: "UpdateSessionEntityType" }); + + /** + * Calls UpdateSessionEntityType. + * @function updateSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest} request UpdateSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes#deleteSessionEntityType}. + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @typedef DeleteSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteSessionEntityType. + * @function deleteSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest} request DeleteSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.DeleteSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.deleteSessionEntityType = function deleteSessionEntityType(request, callback) { + return this.rpcCall(deleteSessionEntityType, $root.google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteSessionEntityType" }); + + /** + * Calls DeleteSessionEntityType. + * @function deleteSessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest} request DeleteSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SessionEntityTypes; + })(); + + v3beta1.SessionEntityType = (function() { + + /** + * Properties of a SessionEntityType. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ISessionEntityType + * @property {string|null} [name] SessionEntityType name + * @property {google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode|null} [entityOverrideMode] SessionEntityType entityOverrideMode + * @property {Array.|null} [entities] SessionEntityType entities + */ + + /** + * Constructs a new SessionEntityType. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SessionEntityType. + * @implements ISessionEntityType + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType=} [properties] Properties to set + */ + function SessionEntityType(properties) { + this.entities = []; + 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]]; + } + + /** + * SessionEntityType name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @instance + */ + SessionEntityType.prototype.name = ""; + + /** + * SessionEntityType entityOverrideMode. + * @member {google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode} entityOverrideMode + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @instance + */ + SessionEntityType.prototype.entityOverrideMode = 0; + + /** + * SessionEntityType entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @instance + */ + SessionEntityType.prototype.entities = $util.emptyArray; + + /** + * Creates a new SessionEntityType instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} SessionEntityType instance + */ + SessionEntityType.create = function create(properties) { + return new SessionEntityType(properties); + }; + + /** + * Encodes the specified SessionEntityType message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType} message SessionEntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionEntityType.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.entityOverrideMode != null && Object.hasOwnProperty.call(message, "entityOverrideMode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.entityOverrideMode); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SessionEntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType} message SessionEntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionEntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @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.SessionEntityType} SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionEntityType.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.SessionEntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.entityOverrideMode = reader.int32(); + break; + case 4: + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionEntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SessionEntityType message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SessionEntityType.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.entityOverrideMode != null && message.hasOwnProperty("entityOverrideMode")) + switch (message.entityOverrideMode) { + default: + return "entityOverrideMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + return null; + }; + + /** + * Creates a SessionEntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} SessionEntityType + */ + SessionEntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType(); + if (object.name != null) + message.name = String(object.name); + switch (object.entityOverrideMode) { + case "ENTITY_OVERRIDE_MODE_UNSPECIFIED": + case 0: + message.entityOverrideMode = 0; + break; + case "ENTITY_OVERRIDE_MODE_OVERRIDE": + case 1: + message.entityOverrideMode = 1; + break; + case "ENTITY_OVERRIDE_MODE_SUPPLEMENT": + case 2: + message.entityOverrideMode = 2; + break; + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SessionEntityType.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SessionEntityType.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.fromObject(object.entities[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SessionEntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} message SessionEntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SessionEntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.name = ""; + object.entityOverrideMode = options.enums === String ? "ENTITY_OVERRIDE_MODE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.entityOverrideMode != null && message.hasOwnProperty("entityOverrideMode")) + object.entityOverrideMode = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode[message.entityOverrideMode] : message.entityOverrideMode; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.cx.v3beta1.EntityType.Entity.toObject(message.entities[j], options); + } + return object; + }; + + /** + * Converts this SessionEntityType to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionEntityType + * @instance + * @returns {Object.} JSON object + */ + SessionEntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * EntityOverrideMode enum. + * @name google.cloud.dialogflow.cx.v3beta1.SessionEntityType.EntityOverrideMode + * @enum {number} + * @property {number} ENTITY_OVERRIDE_MODE_UNSPECIFIED=0 ENTITY_OVERRIDE_MODE_UNSPECIFIED value + * @property {number} ENTITY_OVERRIDE_MODE_OVERRIDE=1 ENTITY_OVERRIDE_MODE_OVERRIDE value + * @property {number} ENTITY_OVERRIDE_MODE_SUPPLEMENT=2 ENTITY_OVERRIDE_MODE_SUPPLEMENT value + */ + SessionEntityType.EntityOverrideMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENTITY_OVERRIDE_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENTITY_OVERRIDE_MODE_OVERRIDE"] = 1; + values[valuesById[2] = "ENTITY_OVERRIDE_MODE_SUPPLEMENT"] = 2; + return values; + })(); + + return SessionEntityType; + })(); + + v3beta1.ListSessionEntityTypesRequest = (function() { + + /** + * Properties of a ListSessionEntityTypesRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListSessionEntityTypesRequest + * @property {string|null} [parent] ListSessionEntityTypesRequest parent + * @property {number|null} [pageSize] ListSessionEntityTypesRequest pageSize + * @property {string|null} [pageToken] ListSessionEntityTypesRequest pageToken + */ + + /** + * Constructs a new ListSessionEntityTypesRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListSessionEntityTypesRequest. + * @implements IListSessionEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest=} [properties] Properties to set + */ + function ListSessionEntityTypesRequest(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]]; + } + + /** + * ListSessionEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.parent = ""; + + /** + * ListSessionEntityTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.pageSize = 0; + + /** + * ListSessionEntityTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListSessionEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest instance + */ + ListSessionEntityTypesRequest.create = function create(properties) { + return new ListSessionEntityTypesRequest(properties); + }; + + /** + * Encodes the specified ListSessionEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest} message ListSessionEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListSessionEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest} message ListSessionEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @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.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesRequest.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.ListSessionEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSessionEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSessionEntityTypesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListSessionEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + */ + ListSessionEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListSessionEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest} message ListSessionEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSessionEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListSessionEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListSessionEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListSessionEntityTypesRequest; + })(); + + v3beta1.ListSessionEntityTypesResponse = (function() { + + /** + * Properties of a ListSessionEntityTypesResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListSessionEntityTypesResponse + * @property {Array.|null} [sessionEntityTypes] ListSessionEntityTypesResponse sessionEntityTypes + * @property {string|null} [nextPageToken] ListSessionEntityTypesResponse nextPageToken + */ + + /** + * Constructs a new ListSessionEntityTypesResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListSessionEntityTypesResponse. + * @implements IListSessionEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse=} [properties] Properties to set + */ + function ListSessionEntityTypesResponse(properties) { + this.sessionEntityTypes = []; + 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]]; + } + + /** + * ListSessionEntityTypesResponse sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @instance + */ + ListSessionEntityTypesResponse.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * ListSessionEntityTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @instance + */ + ListSessionEntityTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSessionEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse instance + */ + ListSessionEntityTypesResponse.create = function create(properties) { + return new ListSessionEntityTypesResponse(properties); + }; + + /** + * Encodes the specified ListSessionEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse} message ListSessionEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.encode(message.sessionEntityTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListSessionEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse} message ListSessionEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @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.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesResponse.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.ListSessionEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSessionEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSessionEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSessionEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + */ + ListSessionEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse(); + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSessionEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse} message ListSessionEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSessionEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sessionEntityTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSessionEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListSessionEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListSessionEntityTypesResponse; + })(); + + v3beta1.GetSessionEntityTypeRequest = (function() { + + /** + * Properties of a GetSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetSessionEntityTypeRequest + * @property {string|null} [name] GetSessionEntityTypeRequest name + */ + + /** + * Constructs a new GetSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetSessionEntityTypeRequest. + * @implements IGetSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest=} [properties] Properties to set + */ + function GetSessionEntityTypeRequest(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]]; + } + + /** + * GetSessionEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @instance + */ + GetSessionEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new GetSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest instance + */ + GetSessionEntityTypeRequest.create = function create(properties) { + return new GetSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified GetSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest} message GetSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSessionEntityTypeRequest.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); + return writer; + }; + + /** + * Encodes the specified GetSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest} message GetSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @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.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSessionEntityTypeRequest.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.GetSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSessionEntityTypeRequest.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"; + return null; + }; + + /** + * Creates a GetSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + */ + GetSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest} message GetSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetSessionEntityTypeRequest; + })(); + + v3beta1.CreateSessionEntityTypeRequest = (function() { + + /** + * Properties of a CreateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateSessionEntityTypeRequest + * @property {string|null} [parent] CreateSessionEntityTypeRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null} [sessionEntityType] CreateSessionEntityTypeRequest sessionEntityType + */ + + /** + * Constructs a new CreateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateSessionEntityTypeRequest. + * @implements ICreateSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest=} [properties] Properties to set + */ + function CreateSessionEntityTypeRequest(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]]; + } + + /** + * CreateSessionEntityTypeRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @instance + */ + CreateSessionEntityTypeRequest.prototype.parent = ""; + + /** + * CreateSessionEntityTypeRequest sessionEntityType. + * @member {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null|undefined} sessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @instance + */ + CreateSessionEntityTypeRequest.prototype.sessionEntityType = null; + + /** + * Creates a new CreateSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest instance + */ + CreateSessionEntityTypeRequest.create = function create(properties) { + return new CreateSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSessionEntityTypeRequest.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.sessionEntityType != null && Object.hasOwnProperty.call(message, "sessionEntityType")) + $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.encode(message.sessionEntityType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @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.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSessionEntityTypeRequest.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.CreateSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.sessionEntityType = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSessionEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify(message.sessionEntityType); + if (error) + return "sessionEntityType." + error; + } + return null; + }; + + /** + * Creates a CreateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + */ + CreateSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sessionEntityType != null) { + if (typeof object.sessionEntityType !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest.sessionEntityType: object expected"); + message.sessionEntityType = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.fromObject(object.sessionEntityType); + } + return message; + }; + + /** + * Creates a plain object from a CreateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sessionEntityType = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) + object.sessionEntityType = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.toObject(message.sessionEntityType, options); + return object; + }; + + /** + * Converts this CreateSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateSessionEntityTypeRequest; + })(); + + v3beta1.UpdateSessionEntityTypeRequest = (function() { + + /** + * Properties of an UpdateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateSessionEntityTypeRequest + * @property {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null} [sessionEntityType] UpdateSessionEntityTypeRequest sessionEntityType + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSessionEntityTypeRequest updateMask + */ + + /** + * Constructs a new UpdateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateSessionEntityTypeRequest. + * @implements IUpdateSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest=} [properties] Properties to set + */ + function UpdateSessionEntityTypeRequest(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]]; + } + + /** + * UpdateSessionEntityTypeRequest sessionEntityType. + * @member {google.cloud.dialogflow.cx.v3beta1.ISessionEntityType|null|undefined} sessionEntityType + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @instance + */ + UpdateSessionEntityTypeRequest.prototype.sessionEntityType = null; + + /** + * UpdateSessionEntityTypeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @instance + */ + UpdateSessionEntityTypeRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest instance + */ + UpdateSessionEntityTypeRequest.create = function create(properties) { + return new UpdateSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSessionEntityTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionEntityType != null && Object.hasOwnProperty.call(message, "sessionEntityType")) + $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.encode(message.sessionEntityType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @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.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSessionEntityTypeRequest.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.UpdateSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sessionEntityType = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSessionEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.verify(message.sessionEntityType); + if (error) + return "sessionEntityType." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + */ + UpdateSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest(); + if (object.sessionEntityType != null) { + if (typeof object.sessionEntityType !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest.sessionEntityType: object expected"); + message.sessionEntityType = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.fromObject(object.sessionEntityType); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sessionEntityType = null; + object.updateMask = null; + } + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) + object.sessionEntityType = $root.google.cloud.dialogflow.cx.v3beta1.SessionEntityType.toObject(message.sessionEntityType, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateSessionEntityTypeRequest; + })(); + + v3beta1.DeleteSessionEntityTypeRequest = (function() { + + /** + * Properties of a DeleteSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteSessionEntityTypeRequest + * @property {string|null} [name] DeleteSessionEntityTypeRequest name + */ + + /** + * Constructs a new DeleteSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteSessionEntityTypeRequest. + * @implements IDeleteSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest=} [properties] Properties to set + */ + function DeleteSessionEntityTypeRequest(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]]; + } + + /** + * DeleteSessionEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @instance + */ + DeleteSessionEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new DeleteSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest instance + */ + DeleteSessionEntityTypeRequest.create = function create(properties) { + return new DeleteSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSessionEntityTypeRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @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.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSessionEntityTypeRequest.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.DeleteSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSessionEntityTypeRequest.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"; + return null; + }; + + /** + * Creates a DeleteSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + */ + DeleteSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteSessionEntityTypeRequest; + })(); + + v3beta1.TransitionRouteGroups = (function() { + + /** + * Constructs a new TransitionRouteGroups service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a TransitionRouteGroups + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function TransitionRouteGroups(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (TransitionRouteGroups.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = TransitionRouteGroups; + + /** + * Creates new TransitionRouteGroups service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {TransitionRouteGroups} RPC service. Useful where requests and/or responses are streamed. + */ + TransitionRouteGroups.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#listTransitionRouteGroups}. + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @typedef ListTransitionRouteGroupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse} [response] ListTransitionRouteGroupsResponse + */ + + /** + * Calls ListTransitionRouteGroups. + * @function listTransitionRouteGroups + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest} request ListTransitionRouteGroupsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.ListTransitionRouteGroupsCallback} callback Node-style callback called with the error, if any, and ListTransitionRouteGroupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TransitionRouteGroups.prototype.listTransitionRouteGroups = function listTransitionRouteGroups(request, callback) { + return this.rpcCall(listTransitionRouteGroups, $root.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse, request, callback); + }, "name", { value: "ListTransitionRouteGroups" }); + + /** + * Calls ListTransitionRouteGroups. + * @function listTransitionRouteGroups + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest} request ListTransitionRouteGroupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#getTransitionRouteGroup}. + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @typedef GetTransitionRouteGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} [response] TransitionRouteGroup + */ + + /** + * Calls GetTransitionRouteGroup. + * @function getTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest} request GetTransitionRouteGroupRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.GetTransitionRouteGroupCallback} callback Node-style callback called with the error, if any, and TransitionRouteGroup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TransitionRouteGroups.prototype.getTransitionRouteGroup = function getTransitionRouteGroup(request, callback) { + return this.rpcCall(getTransitionRouteGroup, $root.google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest, $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup, request, callback); + }, "name", { value: "GetTransitionRouteGroup" }); + + /** + * Calls GetTransitionRouteGroup. + * @function getTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest} request GetTransitionRouteGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#createTransitionRouteGroup}. + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @typedef CreateTransitionRouteGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} [response] TransitionRouteGroup + */ + + /** + * Calls CreateTransitionRouteGroup. + * @function createTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest} request CreateTransitionRouteGroupRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.CreateTransitionRouteGroupCallback} callback Node-style callback called with the error, if any, and TransitionRouteGroup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TransitionRouteGroups.prototype.createTransitionRouteGroup = function createTransitionRouteGroup(request, callback) { + return this.rpcCall(createTransitionRouteGroup, $root.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest, $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup, request, callback); + }, "name", { value: "CreateTransitionRouteGroup" }); + + /** + * Calls CreateTransitionRouteGroup. + * @function createTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest} request CreateTransitionRouteGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#updateTransitionRouteGroup}. + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @typedef UpdateTransitionRouteGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} [response] TransitionRouteGroup + */ + + /** + * Calls UpdateTransitionRouteGroup. + * @function updateTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest} request UpdateTransitionRouteGroupRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.UpdateTransitionRouteGroupCallback} callback Node-style callback called with the error, if any, and TransitionRouteGroup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TransitionRouteGroups.prototype.updateTransitionRouteGroup = function updateTransitionRouteGroup(request, callback) { + return this.rpcCall(updateTransitionRouteGroup, $root.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest, $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup, request, callback); + }, "name", { value: "UpdateTransitionRouteGroup" }); + + /** + * Calls UpdateTransitionRouteGroup. + * @function updateTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest} request UpdateTransitionRouteGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups#deleteTransitionRouteGroup}. + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @typedef DeleteTransitionRouteGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteTransitionRouteGroup. + * @function deleteTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest} request DeleteTransitionRouteGroupRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.DeleteTransitionRouteGroupCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(TransitionRouteGroups.prototype.deleteTransitionRouteGroup = function deleteTransitionRouteGroup(request, callback) { + return this.rpcCall(deleteTransitionRouteGroup, $root.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteTransitionRouteGroup" }); + + /** + * Calls DeleteTransitionRouteGroup. + * @function deleteTransitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest} request DeleteTransitionRouteGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return TransitionRouteGroups; + })(); + + v3beta1.TransitionRouteGroup = (function() { + + /** + * Properties of a TransitionRouteGroup. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ITransitionRouteGroup + * @property {string|null} [name] TransitionRouteGroup name + * @property {string|null} [displayName] TransitionRouteGroup displayName + * @property {Array.|null} [transitionRoutes] TransitionRouteGroup transitionRoutes + */ + + /** + * Constructs a new TransitionRouteGroup. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a TransitionRouteGroup. + * @implements ITransitionRouteGroup + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup=} [properties] Properties to set + */ + function TransitionRouteGroup(properties) { + this.transitionRoutes = []; + 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]]; + } + + /** + * TransitionRouteGroup name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @instance + */ + TransitionRouteGroup.prototype.name = ""; + + /** + * TransitionRouteGroup displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @instance + */ + TransitionRouteGroup.prototype.displayName = ""; + + /** + * TransitionRouteGroup transitionRoutes. + * @member {Array.} transitionRoutes + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @instance + */ + TransitionRouteGroup.prototype.transitionRoutes = $util.emptyArray; + + /** + * Creates a new TransitionRouteGroup instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} TransitionRouteGroup instance + */ + TransitionRouteGroup.create = function create(properties) { + return new TransitionRouteGroup(properties); + }; + + /** + * Encodes the specified TransitionRouteGroup message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup} message TransitionRouteGroup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransitionRouteGroup.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.transitionRoutes != null && message.transitionRoutes.length) + for (var i = 0; i < message.transitionRoutes.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.encode(message.transitionRoutes[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TransitionRouteGroup message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup} message TransitionRouteGroup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TransitionRouteGroup.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TransitionRouteGroup message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @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.TransitionRouteGroup} TransitionRouteGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransitionRouteGroup.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.TransitionRouteGroup(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 5: + if (!(message.transitionRoutes && message.transitionRoutes.length)) + message.transitionRoutes = []; + message.transitionRoutes.push($root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TransitionRouteGroup message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} TransitionRouteGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TransitionRouteGroup.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TransitionRouteGroup message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TransitionRouteGroup.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.transitionRoutes != null && message.hasOwnProperty("transitionRoutes")) { + if (!Array.isArray(message.transitionRoutes)) + return "transitionRoutes: array expected"; + for (var i = 0; i < message.transitionRoutes.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.verify(message.transitionRoutes[i]); + if (error) + return "transitionRoutes." + error; + } + } + return null; + }; + + /** + * Creates a TransitionRouteGroup message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} TransitionRouteGroup + */ + TransitionRouteGroup.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.transitionRoutes) { + if (!Array.isArray(object.transitionRoutes)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.transitionRoutes: array expected"); + message.transitionRoutes = []; + for (var i = 0; i < object.transitionRoutes.length; ++i) { + if (typeof object.transitionRoutes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.transitionRoutes: object expected"); + message.transitionRoutes[i] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.fromObject(object.transitionRoutes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TransitionRouteGroup message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} message TransitionRouteGroup + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TransitionRouteGroup.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.transitionRoutes = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.transitionRoutes && message.transitionRoutes.length) { + object.transitionRoutes = []; + for (var j = 0; j < message.transitionRoutes.length; ++j) + object.transitionRoutes[j] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRoute.toObject(message.transitionRoutes[j], options); + } + return object; + }; + + /** + * Converts this TransitionRouteGroup to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + * @instance + * @returns {Object.} JSON object + */ + TransitionRouteGroup.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TransitionRouteGroup; + })(); + + v3beta1.ListTransitionRouteGroupsRequest = (function() { + + /** + * Properties of a ListTransitionRouteGroupsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListTransitionRouteGroupsRequest + * @property {string|null} [parent] ListTransitionRouteGroupsRequest parent + * @property {number|null} [pageSize] ListTransitionRouteGroupsRequest pageSize + * @property {string|null} [pageToken] ListTransitionRouteGroupsRequest pageToken + * @property {string|null} [languageCode] ListTransitionRouteGroupsRequest languageCode + */ + + /** + * Constructs a new ListTransitionRouteGroupsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListTransitionRouteGroupsRequest. + * @implements IListTransitionRouteGroupsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest=} [properties] Properties to set + */ + function ListTransitionRouteGroupsRequest(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]]; + } + + /** + * ListTransitionRouteGroupsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @instance + */ + ListTransitionRouteGroupsRequest.prototype.parent = ""; + + /** + * ListTransitionRouteGroupsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @instance + */ + ListTransitionRouteGroupsRequest.prototype.pageSize = 0; + + /** + * ListTransitionRouteGroupsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @instance + */ + ListTransitionRouteGroupsRequest.prototype.pageToken = ""; + + /** + * ListTransitionRouteGroupsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @instance + */ + ListTransitionRouteGroupsRequest.prototype.languageCode = ""; + + /** + * Creates a new ListTransitionRouteGroupsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest} ListTransitionRouteGroupsRequest instance + */ + ListTransitionRouteGroupsRequest.create = function create(properties) { + return new ListTransitionRouteGroupsRequest(properties); + }; + + /** + * Encodes the specified ListTransitionRouteGroupsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest} message ListTransitionRouteGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTransitionRouteGroupsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified ListTransitionRouteGroupsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest} message ListTransitionRouteGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTransitionRouteGroupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTransitionRouteGroupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @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.ListTransitionRouteGroupsRequest} ListTransitionRouteGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTransitionRouteGroupsRequest.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.ListTransitionRouteGroupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + case 4: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTransitionRouteGroupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest} ListTransitionRouteGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTransitionRouteGroupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTransitionRouteGroupsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTransitionRouteGroupsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a ListTransitionRouteGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest} ListTransitionRouteGroupsRequest + */ + ListTransitionRouteGroupsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a ListTransitionRouteGroupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest} message ListTransitionRouteGroupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTransitionRouteGroupsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this ListTransitionRouteGroupsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListTransitionRouteGroupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListTransitionRouteGroupsRequest; + })(); + + v3beta1.ListTransitionRouteGroupsResponse = (function() { + + /** + * Properties of a ListTransitionRouteGroupsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListTransitionRouteGroupsResponse + * @property {Array.|null} [transitionRouteGroups] ListTransitionRouteGroupsResponse transitionRouteGroups + * @property {string|null} [nextPageToken] ListTransitionRouteGroupsResponse nextPageToken + */ + + /** + * Constructs a new ListTransitionRouteGroupsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListTransitionRouteGroupsResponse. + * @implements IListTransitionRouteGroupsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse=} [properties] Properties to set + */ + function ListTransitionRouteGroupsResponse(properties) { + this.transitionRouteGroups = []; + 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]]; + } + + /** + * ListTransitionRouteGroupsResponse transitionRouteGroups. + * @member {Array.} transitionRouteGroups + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @instance + */ + ListTransitionRouteGroupsResponse.prototype.transitionRouteGroups = $util.emptyArray; + + /** + * ListTransitionRouteGroupsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @instance + */ + ListTransitionRouteGroupsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListTransitionRouteGroupsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse} ListTransitionRouteGroupsResponse instance + */ + ListTransitionRouteGroupsResponse.create = function create(properties) { + return new ListTransitionRouteGroupsResponse(properties); + }; + + /** + * Encodes the specified ListTransitionRouteGroupsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse} message ListTransitionRouteGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTransitionRouteGroupsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transitionRouteGroups != null && message.transitionRouteGroups.length) + for (var i = 0; i < message.transitionRouteGroups.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.encode(message.transitionRouteGroups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListTransitionRouteGroupsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse} message ListTransitionRouteGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTransitionRouteGroupsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTransitionRouteGroupsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @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.ListTransitionRouteGroupsResponse} ListTransitionRouteGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTransitionRouteGroupsResponse.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.ListTransitionRouteGroupsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.transitionRouteGroups && message.transitionRouteGroups.length)) + message.transitionRouteGroups = []; + message.transitionRouteGroups.push($root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTransitionRouteGroupsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse} ListTransitionRouteGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTransitionRouteGroupsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTransitionRouteGroupsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTransitionRouteGroupsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transitionRouteGroups != null && message.hasOwnProperty("transitionRouteGroups")) { + if (!Array.isArray(message.transitionRouteGroups)) + return "transitionRouteGroups: array expected"; + for (var i = 0; i < message.transitionRouteGroups.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify(message.transitionRouteGroups[i]); + if (error) + return "transitionRouteGroups." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListTransitionRouteGroupsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse} ListTransitionRouteGroupsResponse + */ + ListTransitionRouteGroupsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse(); + if (object.transitionRouteGroups) { + if (!Array.isArray(object.transitionRouteGroups)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse.transitionRouteGroups: array expected"); + message.transitionRouteGroups = []; + for (var i = 0; i < object.transitionRouteGroups.length; ++i) { + if (typeof object.transitionRouteGroups[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse.transitionRouteGroups: object expected"); + message.transitionRouteGroups[i] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.fromObject(object.transitionRouteGroups[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListTransitionRouteGroupsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse} message ListTransitionRouteGroupsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTransitionRouteGroupsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.transitionRouteGroups = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.transitionRouteGroups && message.transitionRouteGroups.length) { + object.transitionRouteGroups = []; + for (var j = 0; j < message.transitionRouteGroups.length; ++j) + object.transitionRouteGroups[j] = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.toObject(message.transitionRouteGroups[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListTransitionRouteGroupsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsResponse + * @instance + * @returns {Object.} JSON object + */ + ListTransitionRouteGroupsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListTransitionRouteGroupsResponse; + })(); + + v3beta1.GetTransitionRouteGroupRequest = (function() { + + /** + * Properties of a GetTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetTransitionRouteGroupRequest + * @property {string|null} [name] GetTransitionRouteGroupRequest name + * @property {string|null} [languageCode] GetTransitionRouteGroupRequest languageCode + */ + + /** + * Constructs a new GetTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetTransitionRouteGroupRequest. + * @implements IGetTransitionRouteGroupRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest=} [properties] Properties to set + */ + function GetTransitionRouteGroupRequest(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]]; + } + + /** + * GetTransitionRouteGroupRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @instance + */ + GetTransitionRouteGroupRequest.prototype.name = ""; + + /** + * GetTransitionRouteGroupRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @instance + */ + GetTransitionRouteGroupRequest.prototype.languageCode = ""; + + /** + * Creates a new GetTransitionRouteGroupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest} GetTransitionRouteGroupRequest instance + */ + GetTransitionRouteGroupRequest.create = function create(properties) { + return new GetTransitionRouteGroupRequest(properties); + }; + + /** + * Encodes the specified GetTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest} message GetTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTransitionRouteGroupRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest} message GetTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetTransitionRouteGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetTransitionRouteGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @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.GetTransitionRouteGroupRequest} GetTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTransitionRouteGroupRequest.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.GetTransitionRouteGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest} GetTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetTransitionRouteGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetTransitionRouteGroupRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetTransitionRouteGroupRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest} GetTransitionRouteGroupRequest + */ + GetTransitionRouteGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest} message GetTransitionRouteGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetTransitionRouteGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetTransitionRouteGroupRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest + * @instance + * @returns {Object.} JSON object + */ + GetTransitionRouteGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetTransitionRouteGroupRequest; + })(); + + v3beta1.CreateTransitionRouteGroupRequest = (function() { + + /** + * Properties of a CreateTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateTransitionRouteGroupRequest + * @property {string|null} [parent] CreateTransitionRouteGroupRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null} [transitionRouteGroup] CreateTransitionRouteGroupRequest transitionRouteGroup + * @property {string|null} [languageCode] CreateTransitionRouteGroupRequest languageCode + */ + + /** + * Constructs a new CreateTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateTransitionRouteGroupRequest. + * @implements ICreateTransitionRouteGroupRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest=} [properties] Properties to set + */ + function CreateTransitionRouteGroupRequest(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]]; + } + + /** + * CreateTransitionRouteGroupRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @instance + */ + CreateTransitionRouteGroupRequest.prototype.parent = ""; + + /** + * CreateTransitionRouteGroupRequest transitionRouteGroup. + * @member {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null|undefined} transitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @instance + */ + CreateTransitionRouteGroupRequest.prototype.transitionRouteGroup = null; + + /** + * CreateTransitionRouteGroupRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @instance + */ + CreateTransitionRouteGroupRequest.prototype.languageCode = ""; + + /** + * Creates a new CreateTransitionRouteGroupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest} CreateTransitionRouteGroupRequest instance + */ + CreateTransitionRouteGroupRequest.create = function create(properties) { + return new CreateTransitionRouteGroupRequest(properties); + }; + + /** + * Encodes the specified CreateTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest} message CreateTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTransitionRouteGroupRequest.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.transitionRouteGroup != null && Object.hasOwnProperty.call(message, "transitionRouteGroup")) + $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.encode(message.transitionRouteGroup, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreateTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest} message CreateTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTransitionRouteGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTransitionRouteGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @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.CreateTransitionRouteGroupRequest} CreateTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTransitionRouteGroupRequest.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.CreateTransitionRouteGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.transitionRouteGroup = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest} CreateTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTransitionRouteGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTransitionRouteGroupRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTransitionRouteGroupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.transitionRouteGroup != null && message.hasOwnProperty("transitionRouteGroup")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify(message.transitionRouteGroup); + if (error) + return "transitionRouteGroup." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreateTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest} CreateTransitionRouteGroupRequest + */ + CreateTransitionRouteGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.transitionRouteGroup != null) { + if (typeof object.transitionRouteGroup !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest.transitionRouteGroup: object expected"); + message.transitionRouteGroup = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.fromObject(object.transitionRouteGroup); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreateTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest} message CreateTransitionRouteGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTransitionRouteGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.transitionRouteGroup = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.transitionRouteGroup != null && message.hasOwnProperty("transitionRouteGroup")) + object.transitionRouteGroup = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.toObject(message.transitionRouteGroup, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreateTransitionRouteGroupRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest + * @instance + * @returns {Object.} JSON object + */ + CreateTransitionRouteGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateTransitionRouteGroupRequest; + })(); + + v3beta1.UpdateTransitionRouteGroupRequest = (function() { + + /** + * Properties of an UpdateTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateTransitionRouteGroupRequest + * @property {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null} [transitionRouteGroup] UpdateTransitionRouteGroupRequest transitionRouteGroup + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateTransitionRouteGroupRequest updateMask + * @property {string|null} [languageCode] UpdateTransitionRouteGroupRequest languageCode + */ + + /** + * Constructs a new UpdateTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateTransitionRouteGroupRequest. + * @implements IUpdateTransitionRouteGroupRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest=} [properties] Properties to set + */ + function UpdateTransitionRouteGroupRequest(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]]; + } + + /** + * UpdateTransitionRouteGroupRequest transitionRouteGroup. + * @member {google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup|null|undefined} transitionRouteGroup + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @instance + */ + UpdateTransitionRouteGroupRequest.prototype.transitionRouteGroup = null; + + /** + * UpdateTransitionRouteGroupRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @instance + */ + UpdateTransitionRouteGroupRequest.prototype.updateMask = null; + + /** + * UpdateTransitionRouteGroupRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @instance + */ + UpdateTransitionRouteGroupRequest.prototype.languageCode = ""; + + /** + * Creates a new UpdateTransitionRouteGroupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest} UpdateTransitionRouteGroupRequest instance + */ + UpdateTransitionRouteGroupRequest.create = function create(properties) { + return new UpdateTransitionRouteGroupRequest(properties); + }; + + /** + * Encodes the specified UpdateTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest} message UpdateTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateTransitionRouteGroupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.transitionRouteGroup != null && Object.hasOwnProperty.call(message, "transitionRouteGroup")) + $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.encode(message.transitionRouteGroup, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified UpdateTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest} message UpdateTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateTransitionRouteGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateTransitionRouteGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @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.UpdateTransitionRouteGroupRequest} UpdateTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateTransitionRouteGroupRequest.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.UpdateTransitionRouteGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.transitionRouteGroup = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest} UpdateTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateTransitionRouteGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateTransitionRouteGroupRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateTransitionRouteGroupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.transitionRouteGroup != null && message.hasOwnProperty("transitionRouteGroup")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.verify(message.transitionRouteGroup); + if (error) + return "transitionRouteGroup." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates an UpdateTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest} UpdateTransitionRouteGroupRequest + */ + UpdateTransitionRouteGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest(); + if (object.transitionRouteGroup != null) { + if (typeof object.transitionRouteGroup !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest.transitionRouteGroup: object expected"); + message.transitionRouteGroup = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.fromObject(object.transitionRouteGroup); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from an UpdateTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest} message UpdateTransitionRouteGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateTransitionRouteGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.transitionRouteGroup = null; + object.updateMask = null; + object.languageCode = ""; + } + if (message.transitionRouteGroup != null && message.hasOwnProperty("transitionRouteGroup")) + object.transitionRouteGroup = $root.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup.toObject(message.transitionRouteGroup, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this UpdateTransitionRouteGroupRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateTransitionRouteGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateTransitionRouteGroupRequest; + })(); + + v3beta1.DeleteTransitionRouteGroupRequest = (function() { + + /** + * Properties of a DeleteTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteTransitionRouteGroupRequest + * @property {string|null} [name] DeleteTransitionRouteGroupRequest name + * @property {boolean|null} [force] DeleteTransitionRouteGroupRequest force + */ + + /** + * Constructs a new DeleteTransitionRouteGroupRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteTransitionRouteGroupRequest. + * @implements IDeleteTransitionRouteGroupRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest=} [properties] Properties to set + */ + function DeleteTransitionRouteGroupRequest(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]]; + } + + /** + * DeleteTransitionRouteGroupRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @instance + */ + DeleteTransitionRouteGroupRequest.prototype.name = ""; + + /** + * DeleteTransitionRouteGroupRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @instance + */ + DeleteTransitionRouteGroupRequest.prototype.force = false; + + /** + * Creates a new DeleteTransitionRouteGroupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest} DeleteTransitionRouteGroupRequest instance + */ + DeleteTransitionRouteGroupRequest.create = function create(properties) { + return new DeleteTransitionRouteGroupRequest(properties); + }; + + /** + * Encodes the specified DeleteTransitionRouteGroupRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest} message DeleteTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTransitionRouteGroupRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteTransitionRouteGroupRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest} message DeleteTransitionRouteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteTransitionRouteGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteTransitionRouteGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @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.DeleteTransitionRouteGroupRequest} DeleteTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTransitionRouteGroupRequest.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.DeleteTransitionRouteGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteTransitionRouteGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest} DeleteTransitionRouteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteTransitionRouteGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteTransitionRouteGroupRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteTransitionRouteGroupRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteTransitionRouteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest} DeleteTransitionRouteGroupRequest + */ + DeleteTransitionRouteGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteTransitionRouteGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest} message DeleteTransitionRouteGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteTransitionRouteGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteTransitionRouteGroupRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteTransitionRouteGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteTransitionRouteGroupRequest; + })(); + + v3beta1.Versions = (function() { + + /** + * Constructs a new Versions service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Versions + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Versions(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Versions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Versions; + + /** + * Creates new Versions service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Versions} RPC service. Useful where requests and/or responses are streamed. + */ + Versions.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#listVersions}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @typedef ListVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse} [response] ListVersionsResponse + */ + + /** + * Calls ListVersions. + * @function listVersions + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest} request ListVersionsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Versions.ListVersionsCallback} callback Node-style callback called with the error, if any, and ListVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.listVersions = function listVersions(request, callback) { + return this.rpcCall(listVersions, $root.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse, request, callback); + }, "name", { value: "ListVersions" }); + + /** + * Calls ListVersions. + * @function listVersions + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest} request ListVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#getVersion}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @typedef GetVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Version} [response] Version + */ + + /** + * Calls GetVersion. + * @function getVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest} request GetVersionRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Versions.GetVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.getVersion = function getVersion(request, callback) { + return this.rpcCall(getVersion, $root.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest, $root.google.cloud.dialogflow.cx.v3beta1.Version, request, callback); + }, "name", { value: "GetVersion" }); + + /** + * Calls GetVersion. + * @function getVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest} request GetVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#createVersion}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @typedef CreateVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateVersion. + * @function createVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest} request CreateVersionRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Versions.CreateVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.createVersion = function createVersion(request, callback) { + return this.rpcCall(createVersion, $root.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateVersion" }); + + /** + * Calls CreateVersion. + * @function createVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest} request CreateVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#updateVersion}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @typedef UpdateVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Version} [response] Version + */ + + /** + * Calls UpdateVersion. + * @function updateVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest} request UpdateVersionRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Versions.UpdateVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.updateVersion = function updateVersion(request, callback) { + return this.rpcCall(updateVersion, $root.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest, $root.google.cloud.dialogflow.cx.v3beta1.Version, request, callback); + }, "name", { value: "UpdateVersion" }); + + /** + * Calls UpdateVersion. + * @function updateVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest} request UpdateVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#deleteVersion}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @typedef DeleteVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteVersion. + * @function deleteVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest} request DeleteVersionRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Versions.DeleteVersionCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.deleteVersion = function deleteVersion(request, callback) { + return this.rpcCall(deleteVersion, $root.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteVersion" }); + + /** + * Calls DeleteVersion. + * @function deleteVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest} request DeleteVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Versions#loadVersion}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @typedef LoadVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls LoadVersion. + * @function loadVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest} request LoadVersionRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Versions.LoadVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.loadVersion = function loadVersion(request, callback) { + return this.rpcCall(loadVersion, $root.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "LoadVersion" }); + + /** + * Calls LoadVersion. + * @function loadVersion + * @memberof google.cloud.dialogflow.cx.v3beta1.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest} request LoadVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Versions; + })(); + + v3beta1.CreateVersionOperationMetadata = (function() { + + /** + * Properties of a CreateVersionOperationMetadata. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateVersionOperationMetadata + * @property {string|null} [version] CreateVersionOperationMetadata version + */ + + /** + * Constructs a new CreateVersionOperationMetadata. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateVersionOperationMetadata. + * @implements ICreateVersionOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata=} [properties] Properties to set + */ + function CreateVersionOperationMetadata(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]]; + } + + /** + * CreateVersionOperationMetadata version. + * @member {string} version + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @instance + */ + CreateVersionOperationMetadata.prototype.version = ""; + + /** + * Creates a new CreateVersionOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata} CreateVersionOperationMetadata instance + */ + CreateVersionOperationMetadata.create = function create(properties) { + return new CreateVersionOperationMetadata(properties); + }; + + /** + * Encodes the specified CreateVersionOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata} message CreateVersionOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + return writer; + }; + + /** + * Encodes the specified CreateVersionOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata} message CreateVersionOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateVersionOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @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.CreateVersionOperationMetadata} CreateVersionOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionOperationMetadata.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.CreateVersionOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateVersionOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata} CreateVersionOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateVersionOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateVersionOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a CreateVersionOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata} CreateVersionOperationMetadata + */ + CreateVersionOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata(); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a CreateVersionOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata} message CreateVersionOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateVersionOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.version = ""; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this CreateVersionOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateVersionOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateVersionOperationMetadata; + })(); + + v3beta1.Version = (function() { + + /** + * Properties of a Version. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IVersion + * @property {string|null} [name] Version name + * @property {string|null} [displayName] Version displayName + * @property {string|null} [description] Version description + * @property {google.cloud.dialogflow.cx.v3beta1.INluSettings|null} [nluSettings] Version nluSettings + * @property {google.protobuf.ITimestamp|null} [createTime] Version createTime + * @property {google.cloud.dialogflow.cx.v3beta1.Version.State|null} [state] Version state + */ + + /** + * Constructs a new Version. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Version. + * @implements IVersion + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IVersion=} [properties] Properties to set + */ + function Version(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]]; + } + + /** + * Version name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + */ + Version.prototype.name = ""; + + /** + * Version displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + */ + Version.prototype.displayName = ""; + + /** + * Version description. + * @member {string} description + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + */ + Version.prototype.description = ""; + + /** + * Version nluSettings. + * @member {google.cloud.dialogflow.cx.v3beta1.INluSettings|null|undefined} nluSettings + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + */ + Version.prototype.nluSettings = null; + + /** + * Version createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + */ + Version.prototype.createTime = null; + + /** + * Version state. + * @member {google.cloud.dialogflow.cx.v3beta1.Version.State} state + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + */ + Version.prototype.state = 0; + + /** + * Creates a new Version instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IVersion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Version} Version instance + */ + Version.create = function create(properties) { + return new Version(properties); + }; + + /** + * Encodes the specified Version message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Version.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.nluSettings != null && Object.hasOwnProperty.call(message, "nluSettings")) + $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.encode(message.nluSettings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + return writer; + }; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Version.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Version message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @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.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.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.Version(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.nluSettings = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.decode(reader, reader.uint32()); + break; + case 5: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.state = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Version message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Version.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.nluSettings != null && message.hasOwnProperty("nluSettings")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.verify(message.nluSettings); + if (error) + return "nluSettings." + error; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Version message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Version} Version + */ + Version.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Version) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Version(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.nluSettings != null) { + if (typeof object.nluSettings !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Version.nluSettings: object expected"); + message.nluSettings = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.fromObject(object.nluSettings); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Version.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Version} message Version + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Version.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + object.nluSettings = null; + object.createTime = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.nluSettings != null && message.hasOwnProperty("nluSettings")) + object.nluSettings = $root.google.cloud.dialogflow.cx.v3beta1.NluSettings.toObject(message.nluSettings, options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.Version.State[message.state] : message.state; + return object; + }; + + /** + * Converts this Version to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Version + * @instance + * @returns {Object.} JSON object + */ + Version.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.dialogflow.cx.v3beta1.Version.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + */ + Version.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + return values; + })(); + + return Version; + })(); + + v3beta1.ListVersionsRequest = (function() { + + /** + * Properties of a ListVersionsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListVersionsRequest + * @property {string|null} [parent] ListVersionsRequest parent + * @property {number|null} [pageSize] ListVersionsRequest pageSize + * @property {string|null} [pageToken] ListVersionsRequest pageToken + */ + + /** + * Constructs a new ListVersionsRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListVersionsRequest. + * @implements IListVersionsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest=} [properties] Properties to set + */ + function ListVersionsRequest(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]]; + } + + /** + * ListVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.parent = ""; + + /** + * ListVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.pageSize = 0; + + /** + * ListVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest} ListVersionsRequest instance + */ + ListVersionsRequest.create = function create(properties) { + return new ListVersionsRequest(properties); + }; + + /** + * Encodes the specified ListVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest} message ListVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest} message ListVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @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.ListVersionsRequest} ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsRequest.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.ListVersionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest} ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVersionsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVersionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest} ListVersionsRequest + */ + ListVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest} message ListVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVersionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListVersionsRequest; + })(); + + v3beta1.ListVersionsResponse = (function() { + + /** + * Properties of a ListVersionsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListVersionsResponse + * @property {Array.|null} [versions] ListVersionsResponse versions + * @property {string|null} [nextPageToken] ListVersionsResponse nextPageToken + */ + + /** + * Constructs a new ListVersionsResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListVersionsResponse. + * @implements IListVersionsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse=} [properties] Properties to set + */ + function ListVersionsResponse(properties) { + this.versions = []; + 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]]; + } + + /** + * ListVersionsResponse versions. + * @member {Array.} versions + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @instance + */ + ListVersionsResponse.prototype.versions = $util.emptyArray; + + /** + * ListVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @instance + */ + ListVersionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse} ListVersionsResponse instance + */ + ListVersionsResponse.create = function create(properties) { + return new ListVersionsResponse(properties); + }; + + /** + * Encodes the specified ListVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse} message ListVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Version.encode(message.versions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse} message ListVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @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.ListVersionsResponse} ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsResponse.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.ListVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.dialogflow.cx.v3beta1.Version.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse} ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVersionsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Version.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse} ListVersionsResponse + */ + ListVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse(); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse.versions: object expected"); + message.versions[i] = $root.google.cloud.dialogflow.cx.v3beta1.Version.fromObject(object.versions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse} message ListVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.dialogflow.cx.v3beta1.Version.toObject(message.versions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListVersionsResponse; + })(); + + v3beta1.GetVersionRequest = (function() { + + /** + * Properties of a GetVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetVersionRequest + * @property {string|null} [name] GetVersionRequest name + */ + + /** + * Constructs a new GetVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetVersionRequest. + * @implements IGetVersionRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest=} [properties] Properties to set + */ + function GetVersionRequest(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]]; + } + + /** + * GetVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @instance + */ + GetVersionRequest.prototype.name = ""; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetVersionRequest} GetVersionRequest instance + */ + GetVersionRequest.create = function create(properties) { + return new GetVersionRequest(properties); + }; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.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); + return writer; + }; + + /** + * Encodes the specified GetVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @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.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.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.GetVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetVersionRequest.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"; + return null; + }; + + /** + * Creates a GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetVersionRequest} GetVersionRequest + */ + GetVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetVersionRequest} message GetVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetVersionRequest; + })(); + + v3beta1.CreateVersionRequest = (function() { + + /** + * Properties of a CreateVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateVersionRequest + * @property {string|null} [parent] CreateVersionRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IVersion|null} [version] CreateVersionRequest version + */ + + /** + * Constructs a new CreateVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateVersionRequest. + * @implements ICreateVersionRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest=} [properties] Properties to set + */ + function CreateVersionRequest(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]]; + } + + /** + * CreateVersionRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @instance + */ + CreateVersionRequest.prototype.parent = ""; + + /** + * CreateVersionRequest version. + * @member {google.cloud.dialogflow.cx.v3beta1.IVersion|null|undefined} version + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @instance + */ + CreateVersionRequest.prototype.version = null; + + /** + * Creates a new CreateVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest} CreateVersionRequest instance + */ + CreateVersionRequest.create = function create(properties) { + return new CreateVersionRequest(properties); + }; + + /** + * Encodes the specified CreateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest} message CreateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionRequest.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.version != null && Object.hasOwnProperty.call(message, "version")) + $root.google.cloud.dialogflow.cx.v3beta1.Version.encode(message.version, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest} message CreateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @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.CreateVersionRequest} CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionRequest.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.CreateVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.version = $root.google.cloud.dialogflow.cx.v3beta1.Version.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest} CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Version.verify(message.version); + if (error) + return "version." + error; + } + return null; + }; + + /** + * Creates a CreateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest} CreateVersionRequest + */ + CreateVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest.version: object expected"); + message.version = $root.google.cloud.dialogflow.cx.v3beta1.Version.fromObject(object.version); + } + return message; + }; + + /** + * Creates a plain object from a CreateVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest} message CreateVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.version = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.google.cloud.dialogflow.cx.v3beta1.Version.toObject(message.version, options); + return object; + }; + + /** + * Converts this CreateVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateVersionRequest; + })(); + + v3beta1.UpdateVersionRequest = (function() { + + /** + * Properties of an UpdateVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateVersionRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IVersion|null} [version] UpdateVersionRequest version + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateVersionRequest updateMask + */ + + /** + * Constructs a new UpdateVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateVersionRequest. + * @implements IUpdateVersionRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest=} [properties] Properties to set + */ + function UpdateVersionRequest(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]]; + } + + /** + * UpdateVersionRequest version. + * @member {google.cloud.dialogflow.cx.v3beta1.IVersion|null|undefined} version + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @instance + */ + UpdateVersionRequest.prototype.version = null; + + /** + * UpdateVersionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @instance + */ + UpdateVersionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest} UpdateVersionRequest instance + */ + UpdateVersionRequest.create = function create(properties) { + return new UpdateVersionRequest(properties); + }; + + /** + * Encodes the specified UpdateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest} message UpdateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.google.cloud.dialogflow.cx.v3beta1.Version.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest} message UpdateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @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.UpdateVersionRequest} UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVersionRequest.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.UpdateVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = $root.google.cloud.dialogflow.cx.v3beta1.Version.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest} UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Version.verify(message.version); + if (error) + return "version." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest} UpdateVersionRequest + */ + UpdateVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest(); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest.version: object expected"); + message.version = $root.google.cloud.dialogflow.cx.v3beta1.Version.fromObject(object.version); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest} message UpdateVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = null; + object.updateMask = null; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.google.cloud.dialogflow.cx.v3beta1.Version.toObject(message.version, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateVersionRequest; + })(); + + v3beta1.DeleteVersionRequest = (function() { + + /** + * Properties of a DeleteVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteVersionRequest + * @property {string|null} [name] DeleteVersionRequest name + */ + + /** + * Constructs a new DeleteVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteVersionRequest. + * @implements IDeleteVersionRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest=} [properties] Properties to set + */ + function DeleteVersionRequest(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]]; + } + + /** + * DeleteVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @instance + */ + DeleteVersionRequest.prototype.name = ""; + + /** + * Creates a new DeleteVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest} DeleteVersionRequest instance + */ + DeleteVersionRequest.create = function create(properties) { + return new DeleteVersionRequest(properties); + }; + + /** + * Encodes the specified DeleteVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest} message DeleteVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVersionRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest} message DeleteVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @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.DeleteVersionRequest} DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVersionRequest.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.DeleteVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest} DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteVersionRequest.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"; + return null; + }; + + /** + * Creates a DeleteVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest} DeleteVersionRequest + */ + DeleteVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest} message DeleteVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteVersionRequest; + })(); + + v3beta1.LoadVersionRequest = (function() { + + /** + * Properties of a LoadVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ILoadVersionRequest + * @property {string|null} [name] LoadVersionRequest name + * @property {boolean|null} [allowOverrideAgentResources] LoadVersionRequest allowOverrideAgentResources + */ + + /** + * Constructs a new LoadVersionRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a LoadVersionRequest. + * @implements ILoadVersionRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest=} [properties] Properties to set + */ + function LoadVersionRequest(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]]; + } + + /** + * LoadVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @instance + */ + LoadVersionRequest.prototype.name = ""; + + /** + * LoadVersionRequest allowOverrideAgentResources. + * @member {boolean} allowOverrideAgentResources + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @instance + */ + LoadVersionRequest.prototype.allowOverrideAgentResources = false; + + /** + * Creates a new LoadVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest} LoadVersionRequest instance + */ + LoadVersionRequest.create = function create(properties) { + return new LoadVersionRequest(properties); + }; + + /** + * Encodes the specified LoadVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest} message LoadVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoadVersionRequest.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.allowOverrideAgentResources != null && Object.hasOwnProperty.call(message, "allowOverrideAgentResources")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowOverrideAgentResources); + return writer; + }; + + /** + * Encodes the specified LoadVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest} message LoadVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoadVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LoadVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @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.LoadVersionRequest} LoadVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoadVersionRequest.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.LoadVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.allowOverrideAgentResources = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LoadVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest} LoadVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoadVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LoadVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LoadVersionRequest.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.allowOverrideAgentResources != null && message.hasOwnProperty("allowOverrideAgentResources")) + if (typeof message.allowOverrideAgentResources !== "boolean") + return "allowOverrideAgentResources: boolean expected"; + return null; + }; + + /** + * Creates a LoadVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest} LoadVersionRequest + */ + LoadVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.allowOverrideAgentResources != null) + message.allowOverrideAgentResources = Boolean(object.allowOverrideAgentResources); + return message; + }; + + /** + * Creates a plain object from a LoadVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest} message LoadVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LoadVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.allowOverrideAgentResources = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.allowOverrideAgentResources != null && message.hasOwnProperty("allowOverrideAgentResources")) + object.allowOverrideAgentResources = message.allowOverrideAgentResources; + return object; + }; + + /** + * Converts this LoadVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest + * @instance + * @returns {Object.} JSON object + */ + LoadVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LoadVersionRequest; + })(); + + v3beta1.Webhooks = (function() { + + /** + * Constructs a new Webhooks service. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Webhooks + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Webhooks(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Webhooks.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Webhooks; + + /** + * Creates new Webhooks service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Webhooks} RPC service. Useful where requests and/or responses are streamed. + */ + Webhooks.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#listWebhooks}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @typedef ListWebhooksCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse} [response] ListWebhooksResponse + */ + + /** + * Calls ListWebhooks. + * @function listWebhooks + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest} request ListWebhooksRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Webhooks.ListWebhooksCallback} callback Node-style callback called with the error, if any, and ListWebhooksResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Webhooks.prototype.listWebhooks = function listWebhooks(request, callback) { + return this.rpcCall(listWebhooks, $root.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest, $root.google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse, request, callback); + }, "name", { value: "ListWebhooks" }); + + /** + * Calls ListWebhooks. + * @function listWebhooks + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest} request ListWebhooksRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#getWebhook}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @typedef GetWebhookCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook} [response] Webhook + */ + + /** + * Calls GetWebhook. + * @function getWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest} request GetWebhookRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Webhooks.GetWebhookCallback} callback Node-style callback called with the error, if any, and Webhook + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Webhooks.prototype.getWebhook = function getWebhook(request, callback) { + return this.rpcCall(getWebhook, $root.google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest, $root.google.cloud.dialogflow.cx.v3beta1.Webhook, request, callback); + }, "name", { value: "GetWebhook" }); + + /** + * Calls GetWebhook. + * @function getWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest} request GetWebhookRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#createWebhook}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @typedef CreateWebhookCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook} [response] Webhook + */ + + /** + * Calls CreateWebhook. + * @function createWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest} request CreateWebhookRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Webhooks.CreateWebhookCallback} callback Node-style callback called with the error, if any, and Webhook + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Webhooks.prototype.createWebhook = function createWebhook(request, callback) { + return this.rpcCall(createWebhook, $root.google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest, $root.google.cloud.dialogflow.cx.v3beta1.Webhook, request, callback); + }, "name", { value: "CreateWebhook" }); + + /** + * Calls CreateWebhook. + * @function createWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest} request CreateWebhookRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#updateWebhook}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @typedef UpdateWebhookCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook} [response] Webhook + */ + + /** + * Calls UpdateWebhook. + * @function updateWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest} request UpdateWebhookRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Webhooks.UpdateWebhookCallback} callback Node-style callback called with the error, if any, and Webhook + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Webhooks.prototype.updateWebhook = function updateWebhook(request, callback) { + return this.rpcCall(updateWebhook, $root.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest, $root.google.cloud.dialogflow.cx.v3beta1.Webhook, request, callback); + }, "name", { value: "UpdateWebhook" }); + + /** + * Calls UpdateWebhook. + * @function updateWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest} request UpdateWebhookRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3beta1.Webhooks#deleteWebhook}. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @typedef DeleteWebhookCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteWebhook. + * @function deleteWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest} request DeleteWebhookRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3beta1.Webhooks.DeleteWebhookCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Webhooks.prototype.deleteWebhook = function deleteWebhook(request, callback) { + return this.rpcCall(deleteWebhook, $root.google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteWebhook" }); + + /** + * Calls DeleteWebhook. + * @function deleteWebhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhooks + * @instance + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest} request DeleteWebhookRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Webhooks; + })(); + + v3beta1.Webhook = (function() { + + /** + * Properties of a Webhook. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IWebhook + * @property {string|null} [name] Webhook name + * @property {string|null} [displayName] Webhook displayName + * @property {google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService|null} [genericWebService] Webhook genericWebService + * @property {google.protobuf.IDuration|null} [timeout] Webhook timeout + * @property {boolean|null} [disabled] Webhook disabled + */ + + /** + * Constructs a new Webhook. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a Webhook. + * @implements IWebhook + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhook=} [properties] Properties to set + */ + function Webhook(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]]; + } + + /** + * Webhook name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + */ + Webhook.prototype.name = ""; + + /** + * Webhook displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + */ + Webhook.prototype.displayName = ""; + + /** + * Webhook genericWebService. + * @member {google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService|null|undefined} genericWebService + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + */ + Webhook.prototype.genericWebService = null; + + /** + * Webhook timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + */ + Webhook.prototype.timeout = null; + + /** + * Webhook disabled. + * @member {boolean} disabled + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + */ + Webhook.prototype.disabled = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Webhook webhook. + * @member {"genericWebService"|undefined} webhook + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + */ + Object.defineProperty(Webhook.prototype, "webhook", { + get: $util.oneOfGetter($oneOfFields = ["genericWebService"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Webhook instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhook=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Webhook} Webhook instance + */ + Webhook.create = function create(properties) { + return new Webhook(properties); + }; + + /** + * Encodes the specified Webhook message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhook} message Webhook message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Webhook.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.genericWebService != null && Object.hasOwnProperty.call(message, "genericWebService")) + $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.encode(message.genericWebService, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disabled); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Webhook message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhook} message Webhook message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Webhook.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Webhook message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @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.Webhook} Webhook + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Webhook.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.Webhook(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 4: + message.genericWebService = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.decode(reader, reader.uint32()); + break; + case 6: + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + case 5: + message.disabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Webhook message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Webhook} Webhook + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Webhook.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Webhook message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Webhook.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.genericWebService != null && message.hasOwnProperty("genericWebService")) { + properties.webhook = 1; + { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.verify(message.genericWebService); + if (error) + return "genericWebService." + error; + } + } + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + return null; + }; + + /** + * Creates a Webhook message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Webhook} Webhook + */ + Webhook.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Webhook) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Webhook(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.genericWebService != null) { + if (typeof object.genericWebService !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Webhook.genericWebService: object expected"); + message.genericWebService = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.fromObject(object.genericWebService); + } + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Webhook.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + return message; + }; + + /** + * Creates a plain object from a Webhook message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook} message Webhook + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Webhook.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.disabled = false; + object.timeout = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.genericWebService != null && message.hasOwnProperty("genericWebService")) { + object.genericWebService = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.toObject(message.genericWebService, options); + if (options.oneofs) + object.webhook = "genericWebService"; + } + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + return object; + }; + + /** + * Converts this Webhook to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @instance + * @returns {Object.} JSON object + */ + Webhook.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Webhook.GenericWebService = (function() { + + /** + * Properties of a GenericWebService. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @interface IGenericWebService + * @property {string|null} [uri] GenericWebService uri + * @property {string|null} [username] GenericWebService username + * @property {string|null} [password] GenericWebService password + * @property {Object.|null} [requestHeaders] GenericWebService requestHeaders + */ + + /** + * Constructs a new GenericWebService. + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook + * @classdesc Represents a GenericWebService. + * @implements IGenericWebService + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService=} [properties] Properties to set + */ + function GenericWebService(properties) { + this.requestHeaders = {}; + 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]]; + } + + /** + * GenericWebService uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @instance + */ + GenericWebService.prototype.uri = ""; + + /** + * GenericWebService username. + * @member {string} username + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @instance + */ + GenericWebService.prototype.username = ""; + + /** + * GenericWebService password. + * @member {string} password + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @instance + */ + GenericWebService.prototype.password = ""; + + /** + * GenericWebService requestHeaders. + * @member {Object.} requestHeaders + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @instance + */ + GenericWebService.prototype.requestHeaders = $util.emptyObject; + + /** + * Creates a new GenericWebService instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService} GenericWebService instance + */ + GenericWebService.create = function create(properties) { + return new GenericWebService(properties); + }; + + /** + * Encodes the specified GenericWebService message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService} message GenericWebService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenericWebService.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.requestHeaders != null && Object.hasOwnProperty.call(message, "requestHeaders")) + for (var keys = Object.keys(message.requestHeaders), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.requestHeaders[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenericWebService message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook.IGenericWebService} message GenericWebService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenericWebService.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenericWebService message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @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.Webhook.GenericWebService} GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenericWebService.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.Webhook.GenericWebService(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + case 2: + message.username = reader.string(); + break; + case 3: + message.password = reader.string(); + break; + case 4: + if (message.requestHeaders === $util.emptyObject) + message.requestHeaders = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.requestHeaders[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenericWebService message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService} GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenericWebService.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenericWebService message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenericWebService.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.requestHeaders != null && message.hasOwnProperty("requestHeaders")) { + if (!$util.isObject(message.requestHeaders)) + return "requestHeaders: object expected"; + var key = Object.keys(message.requestHeaders); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.requestHeaders[key[i]])) + return "requestHeaders: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a GenericWebService message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService} GenericWebService + */ + GenericWebService.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.requestHeaders) { + if (typeof object.requestHeaders !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService.requestHeaders: object expected"); + message.requestHeaders = {}; + for (var keys = Object.keys(object.requestHeaders), i = 0; i < keys.length; ++i) + message.requestHeaders[keys[i]] = String(object.requestHeaders[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a GenericWebService message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService} message GenericWebService + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenericWebService.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.requestHeaders = {}; + if (options.defaults) { + object.uri = ""; + object.username = ""; + object.password = ""; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + var keys2; + if (message.requestHeaders && (keys2 = Object.keys(message.requestHeaders)).length) { + object.requestHeaders = {}; + for (var j = 0; j < keys2.length; ++j) + object.requestHeaders[keys2[j]] = message.requestHeaders[keys2[j]]; + } + return object; + }; + + /** + * Converts this GenericWebService to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.Webhook.GenericWebService + * @instance + * @returns {Object.} JSON object + */ + GenericWebService.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GenericWebService; + })(); + + return Webhook; + })(); + + v3beta1.ListWebhooksRequest = (function() { + + /** + * Properties of a ListWebhooksRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListWebhooksRequest + * @property {string|null} [parent] ListWebhooksRequest parent + * @property {number|null} [pageSize] ListWebhooksRequest pageSize + * @property {string|null} [pageToken] ListWebhooksRequest pageToken + */ + + /** + * Constructs a new ListWebhooksRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListWebhooksRequest. + * @implements IListWebhooksRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest=} [properties] Properties to set + */ + function ListWebhooksRequest(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]]; + } + + /** + * ListWebhooksRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @instance + */ + ListWebhooksRequest.prototype.parent = ""; + + /** + * ListWebhooksRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @instance + */ + ListWebhooksRequest.prototype.pageSize = 0; + + /** + * ListWebhooksRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @instance + */ + ListWebhooksRequest.prototype.pageToken = ""; + + /** + * Creates a new ListWebhooksRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest} ListWebhooksRequest instance + */ + ListWebhooksRequest.create = function create(properties) { + return new ListWebhooksRequest(properties); + }; + + /** + * Encodes the specified ListWebhooksRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest} message ListWebhooksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWebhooksRequest.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.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListWebhooksRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest} message ListWebhooksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWebhooksRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListWebhooksRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @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.ListWebhooksRequest} ListWebhooksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWebhooksRequest.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.ListWebhooksRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListWebhooksRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest} ListWebhooksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWebhooksRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListWebhooksRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWebhooksRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListWebhooksRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest} ListWebhooksRequest + */ + ListWebhooksRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListWebhooksRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest} message ListWebhooksRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWebhooksRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListWebhooksRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest + * @instance + * @returns {Object.} JSON object + */ + ListWebhooksRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListWebhooksRequest; + })(); + + v3beta1.ListWebhooksResponse = (function() { + + /** + * Properties of a ListWebhooksResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IListWebhooksResponse + * @property {Array.|null} [webhooks] ListWebhooksResponse webhooks + * @property {string|null} [nextPageToken] ListWebhooksResponse nextPageToken + */ + + /** + * Constructs a new ListWebhooksResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a ListWebhooksResponse. + * @implements IListWebhooksResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse=} [properties] Properties to set + */ + function ListWebhooksResponse(properties) { + this.webhooks = []; + 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]]; + } + + /** + * ListWebhooksResponse webhooks. + * @member {Array.} webhooks + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @instance + */ + ListWebhooksResponse.prototype.webhooks = $util.emptyArray; + + /** + * ListWebhooksResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @instance + */ + ListWebhooksResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListWebhooksResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse} ListWebhooksResponse instance + */ + ListWebhooksResponse.create = function create(properties) { + return new ListWebhooksResponse(properties); + }; + + /** + * Encodes the specified ListWebhooksResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse} message ListWebhooksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWebhooksResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.webhooks != null && message.webhooks.length) + for (var i = 0; i < message.webhooks.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.Webhook.encode(message.webhooks[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListWebhooksResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse} message ListWebhooksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWebhooksResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListWebhooksResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @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.ListWebhooksResponse} ListWebhooksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWebhooksResponse.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.ListWebhooksResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.webhooks && message.webhooks.length)) + message.webhooks = []; + message.webhooks.push($root.google.cloud.dialogflow.cx.v3beta1.Webhook.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListWebhooksResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse} ListWebhooksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWebhooksResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListWebhooksResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWebhooksResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.webhooks != null && message.hasOwnProperty("webhooks")) { + if (!Array.isArray(message.webhooks)) + return "webhooks: array expected"; + for (var i = 0; i < message.webhooks.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.verify(message.webhooks[i]); + if (error) + return "webhooks." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListWebhooksResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse} ListWebhooksResponse + */ + ListWebhooksResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse(); + if (object.webhooks) { + if (!Array.isArray(object.webhooks)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse.webhooks: array expected"); + message.webhooks = []; + for (var i = 0; i < object.webhooks.length; ++i) { + if (typeof object.webhooks[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse.webhooks: object expected"); + message.webhooks[i] = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.fromObject(object.webhooks[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListWebhooksResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse} message ListWebhooksResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWebhooksResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.webhooks = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.webhooks && message.webhooks.length) { + object.webhooks = []; + for (var j = 0; j < message.webhooks.length; ++j) + object.webhooks[j] = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.toObject(message.webhooks[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListWebhooksResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.ListWebhooksResponse + * @instance + * @returns {Object.} JSON object + */ + ListWebhooksResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListWebhooksResponse; + })(); + + v3beta1.GetWebhookRequest = (function() { + + /** + * Properties of a GetWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IGetWebhookRequest + * @property {string|null} [name] GetWebhookRequest name + */ + + /** + * Constructs a new GetWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a GetWebhookRequest. + * @implements IGetWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest=} [properties] Properties to set + */ + function GetWebhookRequest(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]]; + } + + /** + * GetWebhookRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @instance + */ + GetWebhookRequest.prototype.name = ""; + + /** + * Creates a new GetWebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest} GetWebhookRequest instance + */ + GetWebhookRequest.create = function create(properties) { + return new GetWebhookRequest(properties); + }; + + /** + * Encodes the specified GetWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest} message GetWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWebhookRequest.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); + return writer; + }; + + /** + * Encodes the specified GetWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest} message GetWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetWebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @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.GetWebhookRequest} GetWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWebhookRequest.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.GetWebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetWebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest} GetWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetWebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetWebhookRequest.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"; + return null; + }; + + /** + * Creates a GetWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest} GetWebhookRequest + */ + GetWebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetWebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest} message GetWebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetWebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetWebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest + * @instance + * @returns {Object.} JSON object + */ + GetWebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetWebhookRequest; + })(); + + v3beta1.CreateWebhookRequest = (function() { + + /** + * Properties of a CreateWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ICreateWebhookRequest + * @property {string|null} [parent] CreateWebhookRequest parent + * @property {google.cloud.dialogflow.cx.v3beta1.IWebhook|null} [webhook] CreateWebhookRequest webhook + */ + + /** + * Constructs a new CreateWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a CreateWebhookRequest. + * @implements ICreateWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest=} [properties] Properties to set + */ + function CreateWebhookRequest(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]]; + } + + /** + * CreateWebhookRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @instance + */ + CreateWebhookRequest.prototype.parent = ""; + + /** + * CreateWebhookRequest webhook. + * @member {google.cloud.dialogflow.cx.v3beta1.IWebhook|null|undefined} webhook + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @instance + */ + CreateWebhookRequest.prototype.webhook = null; + + /** + * Creates a new CreateWebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest} CreateWebhookRequest instance + */ + CreateWebhookRequest.create = function create(properties) { + return new CreateWebhookRequest(properties); + }; + + /** + * Encodes the specified CreateWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest} message CreateWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateWebhookRequest.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.webhook != null && Object.hasOwnProperty.call(message, "webhook")) + $root.google.cloud.dialogflow.cx.v3beta1.Webhook.encode(message.webhook, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest} message CreateWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateWebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateWebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @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.CreateWebhookRequest} CreateWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateWebhookRequest.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.CreateWebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.webhook = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateWebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest} CreateWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateWebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateWebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateWebhookRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.webhook != null && message.hasOwnProperty("webhook")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.verify(message.webhook); + if (error) + return "webhook." + error; + } + return null; + }; + + /** + * Creates a CreateWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest} CreateWebhookRequest + */ + CreateWebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.webhook != null) { + if (typeof object.webhook !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest.webhook: object expected"); + message.webhook = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.fromObject(object.webhook); + } + return message; + }; + + /** + * Creates a plain object from a CreateWebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest} message CreateWebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateWebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.webhook = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.webhook != null && message.hasOwnProperty("webhook")) + object.webhook = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.toObject(message.webhook, options); + return object; + }; + + /** + * Converts this CreateWebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest + * @instance + * @returns {Object.} JSON object + */ + CreateWebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateWebhookRequest; + })(); + + v3beta1.UpdateWebhookRequest = (function() { + + /** + * Properties of an UpdateWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IUpdateWebhookRequest + * @property {google.cloud.dialogflow.cx.v3beta1.IWebhook|null} [webhook] UpdateWebhookRequest webhook + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateWebhookRequest updateMask + */ + + /** + * Constructs a new UpdateWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents an UpdateWebhookRequest. + * @implements IUpdateWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest=} [properties] Properties to set + */ + function UpdateWebhookRequest(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]]; + } + + /** + * UpdateWebhookRequest webhook. + * @member {google.cloud.dialogflow.cx.v3beta1.IWebhook|null|undefined} webhook + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @instance + */ + UpdateWebhookRequest.prototype.webhook = null; + + /** + * UpdateWebhookRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @instance + */ + UpdateWebhookRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateWebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest} UpdateWebhookRequest instance + */ + UpdateWebhookRequest.create = function create(properties) { + return new UpdateWebhookRequest(properties); + }; + + /** + * Encodes the specified UpdateWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest} message UpdateWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateWebhookRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.webhook != null && Object.hasOwnProperty.call(message, "webhook")) + $root.google.cloud.dialogflow.cx.v3beta1.Webhook.encode(message.webhook, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest} message UpdateWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateWebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateWebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @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.UpdateWebhookRequest} UpdateWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateWebhookRequest.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.UpdateWebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.webhook = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.decode(reader, reader.uint32()); + break; + case 2: + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateWebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest} UpdateWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateWebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateWebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateWebhookRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.webhook != null && message.hasOwnProperty("webhook")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.verify(message.webhook); + if (error) + return "webhook." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest} UpdateWebhookRequest + */ + UpdateWebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest(); + if (object.webhook != null) { + if (typeof object.webhook !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest.webhook: object expected"); + message.webhook = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.fromObject(object.webhook); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateWebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest} message UpdateWebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateWebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.webhook = null; + object.updateMask = null; + } + if (message.webhook != null && message.hasOwnProperty("webhook")) + object.webhook = $root.google.cloud.dialogflow.cx.v3beta1.Webhook.toObject(message.webhook, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateWebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateWebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateWebhookRequest; + })(); + + v3beta1.DeleteWebhookRequest = (function() { + + /** + * Properties of a DeleteWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IDeleteWebhookRequest + * @property {string|null} [name] DeleteWebhookRequest name + * @property {boolean|null} [force] DeleteWebhookRequest force + */ + + /** + * Constructs a new DeleteWebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a DeleteWebhookRequest. + * @implements IDeleteWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest=} [properties] Properties to set + */ + function DeleteWebhookRequest(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]]; + } + + /** + * DeleteWebhookRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @instance + */ + DeleteWebhookRequest.prototype.name = ""; + + /** + * DeleteWebhookRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @instance + */ + DeleteWebhookRequest.prototype.force = false; + + /** + * Creates a new DeleteWebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest} DeleteWebhookRequest instance + */ + DeleteWebhookRequest.create = function create(properties) { + return new DeleteWebhookRequest(properties); + }; + + /** + * Encodes the specified DeleteWebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest} message DeleteWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteWebhookRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteWebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest} message DeleteWebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteWebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteWebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @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.DeleteWebhookRequest} DeleteWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteWebhookRequest.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.DeleteWebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.force = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteWebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest} DeleteWebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteWebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteWebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteWebhookRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteWebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest} DeleteWebhookRequest + */ + DeleteWebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteWebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest} message DeleteWebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteWebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteWebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteWebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteWebhookRequest; + })(); + + v3beta1.WebhookRequest = (function() { + + /** + * Properties of a WebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IWebhookRequest + * @property {string|null} [detectIntentResponseId] WebhookRequest detectIntentResponseId + * @property {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo|null} [fulfillmentInfo] WebhookRequest fulfillmentInfo + * @property {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo|null} [intentInfo] WebhookRequest intentInfo + * @property {google.cloud.dialogflow.cx.v3beta1.IPageInfo|null} [pageInfo] WebhookRequest pageInfo + * @property {google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null} [sessionInfo] WebhookRequest sessionInfo + * @property {Array.|null} [messages] WebhookRequest messages + * @property {google.protobuf.IStruct|null} [payload] WebhookRequest payload + */ + + /** + * Constructs a new WebhookRequest. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a WebhookRequest. + * @implements IWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookRequest=} [properties] Properties to set + */ + function WebhookRequest(properties) { + this.messages = []; + 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]]; + } + + /** + * WebhookRequest detectIntentResponseId. + * @member {string} detectIntentResponseId + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.detectIntentResponseId = ""; + + /** + * WebhookRequest fulfillmentInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo|null|undefined} fulfillmentInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.fulfillmentInfo = null; + + /** + * WebhookRequest intentInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo|null|undefined} intentInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.intentInfo = null; + + /** + * WebhookRequest pageInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.IPageInfo|null|undefined} pageInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.pageInfo = null; + + /** + * WebhookRequest sessionInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null|undefined} sessionInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.sessionInfo = null; + + /** + * WebhookRequest messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.messages = $util.emptyArray; + + /** + * WebhookRequest payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.payload = null; + + /** + * Creates a new WebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest} WebhookRequest instance + */ + WebhookRequest.create = function create(properties) { + return new WebhookRequest(properties); + }; + + /** + * Encodes the specified WebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookRequest} message WebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.detectIntentResponseId != null && Object.hasOwnProperty.call(message, "detectIntentResponseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.detectIntentResponseId); + if (message.intentInfo != null && Object.hasOwnProperty.call(message, "intentInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.encode(message.intentInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.pageInfo != null && Object.hasOwnProperty.call(message, "pageInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.encode(message.pageInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.sessionInfo != null && Object.hasOwnProperty.call(message, "sessionInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.encode(message.sessionInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.fulfillmentInfo != null && Object.hasOwnProperty.call(message, "fulfillmentInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.encode(message.fulfillmentInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.encode(message.messages[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookRequest} message WebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @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.WebhookRequest} WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookRequest.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.WebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.detectIntentResponseId = reader.string(); + break; + case 6: + message.fulfillmentInfo = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.decode(reader, reader.uint32()); + break; + case 3: + message.intentInfo = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.decode(reader, reader.uint32()); + break; + case 4: + message.pageInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.decode(reader, reader.uint32()); + break; + case 5: + message.sessionInfo = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.decode(reader, reader.uint32()); + break; + case 7: + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.decode(reader, reader.uint32())); + break; + case 8: + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest} WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebhookRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.detectIntentResponseId != null && message.hasOwnProperty("detectIntentResponseId")) + if (!$util.isString(message.detectIntentResponseId)) + return "detectIntentResponseId: string expected"; + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.verify(message.fulfillmentInfo); + if (error) + return "fulfillmentInfo." + error; + } + if (message.intentInfo != null && message.hasOwnProperty("intentInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.verify(message.intentInfo); + if (error) + return "intentInfo." + error; + } + if (message.pageInfo != null && message.hasOwnProperty("pageInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.verify(message.pageInfo); + if (error) + return "pageInfo." + error; + } + if (message.sessionInfo != null && message.hasOwnProperty("sessionInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.verify(message.sessionInfo); + if (error) + return "sessionInfo." + error; + } + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + return null; + }; + + /** + * Creates a WebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest} WebhookRequest + */ + WebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest(); + if (object.detectIntentResponseId != null) + message.detectIntentResponseId = String(object.detectIntentResponseId); + if (object.fulfillmentInfo != null) { + if (typeof object.fulfillmentInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.fulfillmentInfo: object expected"); + message.fulfillmentInfo = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.fromObject(object.fulfillmentInfo); + } + if (object.intentInfo != null) { + if (typeof object.intentInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.intentInfo: object expected"); + message.intentInfo = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.fromObject(object.intentInfo); + } + if (object.pageInfo != null) { + if (typeof object.pageInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.pageInfo: object expected"); + message.pageInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.fromObject(object.pageInfo); + } + if (object.sessionInfo != null) { + if (typeof object.sessionInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.sessionInfo: object expected"); + message.sessionInfo = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.fromObject(object.sessionInfo); + } + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.fromObject(object.messages[i]); + } + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + return message; + }; + + /** + * Creates a plain object from a WebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest} message WebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messages = []; + if (options.defaults) { + object.detectIntentResponseId = ""; + object.intentInfo = null; + object.pageInfo = null; + object.sessionInfo = null; + object.fulfillmentInfo = null; + object.payload = null; + } + if (message.detectIntentResponseId != null && message.hasOwnProperty("detectIntentResponseId")) + object.detectIntentResponseId = message.detectIntentResponseId; + if (message.intentInfo != null && message.hasOwnProperty("intentInfo")) + object.intentInfo = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.toObject(message.intentInfo, options); + if (message.pageInfo != null && message.hasOwnProperty("pageInfo")) + object.pageInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.toObject(message.pageInfo, options); + if (message.sessionInfo != null && message.hasOwnProperty("sessionInfo")) + object.sessionInfo = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.toObject(message.sessionInfo, options); + if (message.fulfillmentInfo != null && message.hasOwnProperty("fulfillmentInfo")) + object.fulfillmentInfo = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.toObject(message.fulfillmentInfo, options); + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.toObject(message.messages[j], options); + } + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + return object; + }; + + /** + * Converts this WebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @instance + * @returns {Object.} JSON object + */ + WebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + WebhookRequest.FulfillmentInfo = (function() { + + /** + * Properties of a FulfillmentInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @interface IFulfillmentInfo + * @property {string|null} [tag] FulfillmentInfo tag + */ + + /** + * Constructs a new FulfillmentInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @classdesc Represents a FulfillmentInfo. + * @implements IFulfillmentInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo=} [properties] Properties to set + */ + function FulfillmentInfo(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]]; + } + + /** + * FulfillmentInfo tag. + * @member {string} tag + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @instance + */ + FulfillmentInfo.prototype.tag = ""; + + /** + * Creates a new FulfillmentInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo} FulfillmentInfo instance + */ + FulfillmentInfo.create = function create(properties) { + return new FulfillmentInfo(properties); + }; + + /** + * Encodes the specified FulfillmentInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tag != null && Object.hasOwnProperty.call(message, "tag")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tag); + return writer; + }; + + /** + * Encodes the specified FulfillmentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IFulfillmentInfo} message FulfillmentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @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.WebhookRequest.FulfillmentInfo} FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentInfo.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.WebhookRequest.FulfillmentInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tag = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FulfillmentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo} FulfillmentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FulfillmentInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FulfillmentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tag != null && message.hasOwnProperty("tag")) + if (!$util.isString(message.tag)) + return "tag: string expected"; + return null; + }; + + /** + * Creates a FulfillmentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo} FulfillmentInfo + */ + FulfillmentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo(); + if (object.tag != null) + message.tag = String(object.tag); + return message; + }; + + /** + * Creates a plain object from a FulfillmentInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo} message FulfillmentInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FulfillmentInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.tag = ""; + if (message.tag != null && message.hasOwnProperty("tag")) + object.tag = message.tag; + return object; + }; + + /** + * Converts this FulfillmentInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo + * @instance + * @returns {Object.} JSON object + */ + FulfillmentInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FulfillmentInfo; + })(); + + WebhookRequest.IntentInfo = (function() { + + /** + * Properties of an IntentInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @interface IIntentInfo + * @property {string|null} [lastMatchedIntent] IntentInfo lastMatchedIntent + * @property {Object.|null} [parameters] IntentInfo parameters + */ + + /** + * Constructs a new IntentInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest + * @classdesc Represents an IntentInfo. + * @implements IIntentInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo=} [properties] Properties to set + */ + function IntentInfo(properties) { + this.parameters = {}; + 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]]; + } + + /** + * IntentInfo lastMatchedIntent. + * @member {string} lastMatchedIntent + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @instance + */ + IntentInfo.prototype.lastMatchedIntent = ""; + + /** + * IntentInfo parameters. + * @member {Object.} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @instance + */ + IntentInfo.prototype.parameters = $util.emptyObject; + + /** + * Creates a new IntentInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo} IntentInfo instance + */ + IntentInfo.create = function create(properties) { + return new IntentInfo(properties); + }; + + /** + * Encodes the specified IntentInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo} message IntentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lastMatchedIntent != null && Object.hasOwnProperty.call(message, "lastMatchedIntent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.lastMatchedIntent); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + for (var keys = Object.keys(message.parameters), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.encode(message.parameters[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified IntentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IIntentInfo} message IntentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IntentInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @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.WebhookRequest.IntentInfo} IntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentInfo.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.WebhookRequest.IntentInfo(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lastMatchedIntent = reader.string(); + break; + case 2: + if (message.parameters === $util.emptyObject) + message.parameters = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.parameters[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IntentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo} IntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IntentInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IntentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lastMatchedIntent != null && message.hasOwnProperty("lastMatchedIntent")) + if (!$util.isString(message.lastMatchedIntent)) + return "lastMatchedIntent: string expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (!$util.isObject(message.parameters)) + return "parameters: object expected"; + var key = Object.keys(message.parameters); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.verify(message.parameters[key[i]]); + if (error) + return "parameters." + error; + } + } + return null; + }; + + /** + * Creates an IntentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo} IntentInfo + */ + IntentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo(); + if (object.lastMatchedIntent != null) + message.lastMatchedIntent = String(object.lastMatchedIntent); + if (object.parameters) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.parameters: object expected"); + message.parameters = {}; + for (var keys = Object.keys(object.parameters), i = 0; i < keys.length; ++i) { + if (typeof object.parameters[keys[i]] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.parameters: object expected"); + message.parameters[keys[i]] = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.fromObject(object.parameters[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from an IntentInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo} message IntentInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IntentInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.parameters = {}; + if (options.defaults) + object.lastMatchedIntent = ""; + if (message.lastMatchedIntent != null && message.hasOwnProperty("lastMatchedIntent")) + object.lastMatchedIntent = message.lastMatchedIntent; + var keys2; + if (message.parameters && (keys2 = Object.keys(message.parameters)).length) { + object.parameters = {}; + for (var j = 0; j < keys2.length; ++j) + object.parameters[keys2[j]] = $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.toObject(message.parameters[keys2[j]], options); + } + return object; + }; + + /** + * Converts this IntentInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @instance + * @returns {Object.} JSON object + */ + IntentInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + IntentInfo.IntentParameterValue = (function() { + + /** + * Properties of an IntentParameterValue. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @interface IIntentParameterValue + * @property {string|null} [originalValue] IntentParameterValue originalValue + * @property {google.protobuf.IValue|null} [resolvedValue] IntentParameterValue resolvedValue + */ + + /** + * Constructs a new IntentParameterValue. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo + * @classdesc Represents an IntentParameterValue. + * @implements IIntentParameterValue + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue=} [properties] Properties to set + */ + function IntentParameterValue(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]]; + } + + /** + * IntentParameterValue originalValue. + * @member {string} originalValue + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @instance + */ + IntentParameterValue.prototype.originalValue = ""; + + /** + * IntentParameterValue resolvedValue. + * @member {google.protobuf.IValue|null|undefined} resolvedValue + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @instance + */ + IntentParameterValue.prototype.resolvedValue = null; + + /** + * Creates a new IntentParameterValue instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue} IntentParameterValue instance + */ + IntentParameterValue.create = function create(properties) { + return new IntentParameterValue(properties); + }; + + /** + * Encodes the specified IntentParameterValue message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue} message IntentParameterValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentParameterValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.originalValue != null && Object.hasOwnProperty.call(message, "originalValue")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.originalValue); + if (message.resolvedValue != null && Object.hasOwnProperty.call(message, "resolvedValue")) + $root.google.protobuf.Value.encode(message.resolvedValue, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IntentParameterValue message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IIntentParameterValue} message IntentParameterValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentParameterValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IntentParameterValue message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @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.WebhookRequest.IntentInfo.IntentParameterValue} IntentParameterValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentParameterValue.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.WebhookRequest.IntentInfo.IntentParameterValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.originalValue = reader.string(); + break; + case 2: + message.resolvedValue = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IntentParameterValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue} IntentParameterValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentParameterValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IntentParameterValue message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IntentParameterValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.originalValue != null && message.hasOwnProperty("originalValue")) + if (!$util.isString(message.originalValue)) + return "originalValue: string expected"; + if (message.resolvedValue != null && message.hasOwnProperty("resolvedValue")) { + var error = $root.google.protobuf.Value.verify(message.resolvedValue); + if (error) + return "resolvedValue." + error; + } + return null; + }; + + /** + * Creates an IntentParameterValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue} IntentParameterValue + */ + IntentParameterValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue(); + if (object.originalValue != null) + message.originalValue = String(object.originalValue); + if (object.resolvedValue != null) { + if (typeof object.resolvedValue !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue.resolvedValue: object expected"); + message.resolvedValue = $root.google.protobuf.Value.fromObject(object.resolvedValue); + } + return message; + }; + + /** + * Creates a plain object from an IntentParameterValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue} message IntentParameterValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IntentParameterValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.originalValue = ""; + object.resolvedValue = null; + } + if (message.originalValue != null && message.hasOwnProperty("originalValue")) + object.originalValue = message.originalValue; + if (message.resolvedValue != null && message.hasOwnProperty("resolvedValue")) + object.resolvedValue = $root.google.protobuf.Value.toObject(message.resolvedValue, options); + return object; + }; + + /** + * Converts this IntentParameterValue to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookRequest.IntentInfo.IntentParameterValue + * @instance + * @returns {Object.} JSON object + */ + IntentParameterValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IntentParameterValue; + })(); + + return IntentInfo; + })(); + + return WebhookRequest; + })(); + + v3beta1.WebhookResponse = (function() { + + /** + * Properties of a WebhookResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IWebhookResponse + * @property {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse|null} [fulfillmentResponse] WebhookResponse fulfillmentResponse + * @property {google.cloud.dialogflow.cx.v3beta1.IPageInfo|null} [pageInfo] WebhookResponse pageInfo + * @property {google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null} [sessionInfo] WebhookResponse sessionInfo + * @property {google.protobuf.IStruct|null} [payload] WebhookResponse payload + * @property {string|null} [targetPage] WebhookResponse targetPage + * @property {string|null} [targetFlow] WebhookResponse targetFlow + */ + + /** + * Constructs a new WebhookResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a WebhookResponse. + * @implements IWebhookResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookResponse=} [properties] Properties to set + */ + function WebhookResponse(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]]; + } + + /** + * WebhookResponse fulfillmentResponse. + * @member {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse|null|undefined} fulfillmentResponse + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.fulfillmentResponse = null; + + /** + * WebhookResponse pageInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.IPageInfo|null|undefined} pageInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.pageInfo = null; + + /** + * WebhookResponse sessionInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.ISessionInfo|null|undefined} sessionInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.sessionInfo = null; + + /** + * WebhookResponse payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.payload = null; + + /** + * WebhookResponse targetPage. + * @member {string} targetPage + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.targetPage = ""; + + /** + * WebhookResponse targetFlow. + * @member {string} targetFlow + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.targetFlow = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WebhookResponse transition. + * @member {"targetPage"|"targetFlow"|undefined} transition + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + */ + Object.defineProperty(WebhookResponse.prototype, "transition", { + get: $util.oneOfGetter($oneOfFields = ["targetPage", "targetFlow"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WebhookResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookResponse} WebhookResponse instance + */ + WebhookResponse.create = function create(properties) { + return new WebhookResponse(properties); + }; + + /** + * Encodes the specified WebhookResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookResponse} message WebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fulfillmentResponse != null && Object.hasOwnProperty.call(message, "fulfillmentResponse")) + $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.encode(message.fulfillmentResponse, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pageInfo != null && Object.hasOwnProperty.call(message, "pageInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.encode(message.pageInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.sessionInfo != null && Object.hasOwnProperty.call(message, "sessionInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.encode(message.sessionInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.targetPage != null && Object.hasOwnProperty.call(message, "targetPage")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.targetPage); + if (message.targetFlow != null && Object.hasOwnProperty.call(message, "targetFlow")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.targetFlow); + return writer; + }; + + /** + * Encodes the specified WebhookResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IWebhookResponse} message WebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @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.WebhookResponse} WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookResponse.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.WebhookResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fulfillmentResponse = $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.decode(reader, reader.uint32()); + break; + case 2: + message.pageInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sessionInfo = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.decode(reader, reader.uint32()); + break; + case 4: + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + case 5: + message.targetPage = reader.string(); + break; + case 6: + message.targetFlow = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookResponse} WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebhookResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebhookResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.fulfillmentResponse != null && message.hasOwnProperty("fulfillmentResponse")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.verify(message.fulfillmentResponse); + if (error) + return "fulfillmentResponse." + error; + } + if (message.pageInfo != null && message.hasOwnProperty("pageInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.verify(message.pageInfo); + if (error) + return "pageInfo." + error; + } + if (message.sessionInfo != null && message.hasOwnProperty("sessionInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.verify(message.sessionInfo); + if (error) + return "sessionInfo." + error; + } + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + if (message.targetPage != null && message.hasOwnProperty("targetPage")) { + properties.transition = 1; + if (!$util.isString(message.targetPage)) + return "targetPage: string expected"; + } + if (message.targetFlow != null && message.hasOwnProperty("targetFlow")) { + if (properties.transition === 1) + return "transition: multiple values"; + properties.transition = 1; + if (!$util.isString(message.targetFlow)) + return "targetFlow: string expected"; + } + return null; + }; + + /** + * Creates a WebhookResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookResponse} WebhookResponse + */ + WebhookResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse(); + if (object.fulfillmentResponse != null) { + if (typeof object.fulfillmentResponse !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookResponse.fulfillmentResponse: object expected"); + message.fulfillmentResponse = $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.fromObject(object.fulfillmentResponse); + } + if (object.pageInfo != null) { + if (typeof object.pageInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookResponse.pageInfo: object expected"); + message.pageInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.fromObject(object.pageInfo); + } + if (object.sessionInfo != null) { + if (typeof object.sessionInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookResponse.sessionInfo: object expected"); + message.sessionInfo = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.fromObject(object.sessionInfo); + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookResponse.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.targetPage != null) + message.targetPage = String(object.targetPage); + if (object.targetFlow != null) + message.targetFlow = String(object.targetFlow); + return message; + }; + + /** + * Creates a plain object from a WebhookResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookResponse} message WebhookResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebhookResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fulfillmentResponse = null; + object.pageInfo = null; + object.sessionInfo = null; + object.payload = null; + } + if (message.fulfillmentResponse != null && message.hasOwnProperty("fulfillmentResponse")) + object.fulfillmentResponse = $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.toObject(message.fulfillmentResponse, options); + if (message.pageInfo != null && message.hasOwnProperty("pageInfo")) + object.pageInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.toObject(message.pageInfo, options); + if (message.sessionInfo != null && message.hasOwnProperty("sessionInfo")) + object.sessionInfo = $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo.toObject(message.sessionInfo, options); + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (message.targetPage != null && message.hasOwnProperty("targetPage")) { + object.targetPage = message.targetPage; + if (options.oneofs) + object.transition = "targetPage"; + } + if (message.targetFlow != null && message.hasOwnProperty("targetFlow")) { + object.targetFlow = message.targetFlow; + if (options.oneofs) + object.transition = "targetFlow"; + } + return object; + }; + + /** + * Converts this WebhookResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @instance + * @returns {Object.} JSON object + */ + WebhookResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + WebhookResponse.FulfillmentResponse = (function() { + + /** + * Properties of a FulfillmentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @interface IFulfillmentResponse + * @property {Array.|null} [messages] FulfillmentResponse messages + * @property {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior|null} [mergeBehavior] FulfillmentResponse mergeBehavior + */ + + /** + * Constructs a new FulfillmentResponse. + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse + * @classdesc Represents a FulfillmentResponse. + * @implements IFulfillmentResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse=} [properties] Properties to set + */ + function FulfillmentResponse(properties) { + this.messages = []; + 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]]; + } + + /** + * FulfillmentResponse messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @instance + */ + FulfillmentResponse.prototype.messages = $util.emptyArray; + + /** + * FulfillmentResponse mergeBehavior. + * @member {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior} mergeBehavior + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @instance + */ + FulfillmentResponse.prototype.mergeBehavior = 0; + + /** + * Creates a new FulfillmentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse} FulfillmentResponse instance + */ + FulfillmentResponse.create = function create(properties) { + return new FulfillmentResponse(properties); + }; + + /** + * Encodes the specified FulfillmentResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse} message FulfillmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.encode(message.messages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mergeBehavior != null && Object.hasOwnProperty.call(message, "mergeBehavior")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.mergeBehavior); + return writer; + }; + + /** + * Encodes the specified FulfillmentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.IFulfillmentResponse} message FulfillmentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FulfillmentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FulfillmentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @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.WebhookResponse.FulfillmentResponse} FulfillmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentResponse.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.WebhookResponse.FulfillmentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.decode(reader, reader.uint32())); + break; + case 2: + message.mergeBehavior = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FulfillmentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse} FulfillmentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FulfillmentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FulfillmentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FulfillmentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.mergeBehavior != null && message.hasOwnProperty("mergeBehavior")) + switch (message.mergeBehavior) { + default: + return "mergeBehavior: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a FulfillmentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse} FulfillmentResponse + */ + FulfillmentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.fromObject(object.messages[i]); + } + } + switch (object.mergeBehavior) { + case "MERGE_BEHAVIOR_UNSPECIFIED": + case 0: + message.mergeBehavior = 0; + break; + case "APPEND": + case 1: + message.mergeBehavior = 1; + break; + case "REPLACE": + case 2: + message.mergeBehavior = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a FulfillmentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse} message FulfillmentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FulfillmentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messages = []; + if (options.defaults) + object.mergeBehavior = options.enums === String ? "MERGE_BEHAVIOR_UNSPECIFIED" : 0; + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.cx.v3beta1.ResponseMessage.toObject(message.messages[j], options); + } + if (message.mergeBehavior != null && message.hasOwnProperty("mergeBehavior")) + object.mergeBehavior = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior[message.mergeBehavior] : message.mergeBehavior; + return object; + }; + + /** + * Converts this FulfillmentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse + * @instance + * @returns {Object.} JSON object + */ + FulfillmentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * MergeBehavior enum. + * @name google.cloud.dialogflow.cx.v3beta1.WebhookResponse.FulfillmentResponse.MergeBehavior + * @enum {number} + * @property {number} MERGE_BEHAVIOR_UNSPECIFIED=0 MERGE_BEHAVIOR_UNSPECIFIED value + * @property {number} APPEND=1 APPEND value + * @property {number} REPLACE=2 REPLACE value + */ + FulfillmentResponse.MergeBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MERGE_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "APPEND"] = 1; + values[valuesById[2] = "REPLACE"] = 2; + return values; + })(); + + return FulfillmentResponse; + })(); + + return WebhookResponse; + })(); + + v3beta1.PageInfo = (function() { + + /** + * Properties of a PageInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface IPageInfo + * @property {string|null} [currentPage] PageInfo currentPage + * @property {google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo|null} [formInfo] PageInfo formInfo + */ + + /** + * Constructs a new PageInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a PageInfo. + * @implements IPageInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.IPageInfo=} [properties] Properties to set + */ + function PageInfo(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]]; + } + + /** + * PageInfo currentPage. + * @member {string} currentPage + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @instance + */ + PageInfo.prototype.currentPage = ""; + + /** + * PageInfo formInfo. + * @member {google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo|null|undefined} formInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @instance + */ + PageInfo.prototype.formInfo = null; + + /** + * Creates a new PageInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IPageInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo} PageInfo instance + */ + PageInfo.create = function create(properties) { + return new PageInfo(properties); + }; + + /** + * Encodes the specified PageInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IPageInfo} message PageInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currentPage != null && Object.hasOwnProperty.call(message, "currentPage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currentPage); + if (message.formInfo != null && Object.hasOwnProperty.call(message, "formInfo")) + $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.encode(message.formInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PageInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.IPageInfo} message PageInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PageInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PageInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @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.PageInfo} PageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageInfo.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.PageInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currentPage = reader.string(); + break; + case 3: + message.formInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PageInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo} PageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PageInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PageInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PageInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currentPage != null && message.hasOwnProperty("currentPage")) + if (!$util.isString(message.currentPage)) + return "currentPage: string expected"; + if (message.formInfo != null && message.hasOwnProperty("formInfo")) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.verify(message.formInfo); + if (error) + return "formInfo." + error; + } + return null; + }; + + /** + * Creates a PageInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo} PageInfo + */ + PageInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.PageInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.PageInfo(); + if (object.currentPage != null) + message.currentPage = String(object.currentPage); + if (object.formInfo != null) { + if (typeof object.formInfo !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.PageInfo.formInfo: object expected"); + message.formInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.fromObject(object.formInfo); + } + return message; + }; + + /** + * Creates a plain object from a PageInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo} message PageInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PageInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currentPage = ""; + object.formInfo = null; + } + if (message.currentPage != null && message.hasOwnProperty("currentPage")) + object.currentPage = message.currentPage; + if (message.formInfo != null && message.hasOwnProperty("formInfo")) + object.formInfo = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.toObject(message.formInfo, options); + return object; + }; + + /** + * Converts this PageInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @instance + * @returns {Object.} JSON object + */ + PageInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PageInfo.FormInfo = (function() { + + /** + * Properties of a FormInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @interface IFormInfo + * @property {Array.|null} [parameterInfo] FormInfo parameterInfo + */ + + /** + * Constructs a new FormInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo + * @classdesc Represents a FormInfo. + * @implements IFormInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo=} [properties] Properties to set + */ + function FormInfo(properties) { + this.parameterInfo = []; + 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]]; + } + + /** + * FormInfo parameterInfo. + * @member {Array.} parameterInfo + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @instance + */ + FormInfo.prototype.parameterInfo = $util.emptyArray; + + /** + * Creates a new FormInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo} FormInfo instance + */ + FormInfo.create = function create(properties) { + return new FormInfo(properties); + }; + + /** + * Encodes the specified FormInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo} message FormInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parameterInfo != null && message.parameterInfo.length) + for (var i = 0; i < message.parameterInfo.length; ++i) + $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.encode(message.parameterInfo[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FormInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.IFormInfo} message FormInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FormInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FormInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @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.PageInfo.FormInfo} FormInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormInfo.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.PageInfo.FormInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.parameterInfo && message.parameterInfo.length)) + message.parameterInfo = []; + message.parameterInfo.push($root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FormInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo} FormInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FormInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FormInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FormInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parameterInfo != null && message.hasOwnProperty("parameterInfo")) { + if (!Array.isArray(message.parameterInfo)) + return "parameterInfo: array expected"; + for (var i = 0; i < message.parameterInfo.length; ++i) { + var error = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.verify(message.parameterInfo[i]); + if (error) + return "parameterInfo." + error; + } + } + return null; + }; + + /** + * Creates a FormInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo} FormInfo + */ + FormInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo(); + if (object.parameterInfo) { + if (!Array.isArray(object.parameterInfo)) + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.parameterInfo: array expected"); + message.parameterInfo = []; + for (var i = 0; i < object.parameterInfo.length; ++i) { + if (typeof object.parameterInfo[i] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.parameterInfo: object expected"); + message.parameterInfo[i] = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.fromObject(object.parameterInfo[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FormInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo} message FormInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FormInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parameterInfo = []; + if (message.parameterInfo && message.parameterInfo.length) { + object.parameterInfo = []; + for (var j = 0; j < message.parameterInfo.length; ++j) + object.parameterInfo[j] = $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.toObject(message.parameterInfo[j], options); + } + return object; + }; + + /** + * Converts this FormInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @instance + * @returns {Object.} JSON object + */ + FormInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + FormInfo.ParameterInfo = (function() { + + /** + * Properties of a ParameterInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @interface IParameterInfo + * @property {string|null} [displayName] ParameterInfo displayName + * @property {boolean|null} [required] ParameterInfo required + * @property {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState|null} [state] ParameterInfo state + * @property {google.protobuf.IValue|null} [value] ParameterInfo value + * @property {boolean|null} [justCollected] ParameterInfo justCollected + */ + + /** + * Constructs a new ParameterInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo + * @classdesc Represents a ParameterInfo. + * @implements IParameterInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo=} [properties] Properties to set + */ + function ParameterInfo(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]]; + } + + /** + * ParameterInfo displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @instance + */ + ParameterInfo.prototype.displayName = ""; + + /** + * ParameterInfo required. + * @member {boolean} required + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @instance + */ + ParameterInfo.prototype.required = false; + + /** + * ParameterInfo state. + * @member {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState} state + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @instance + */ + ParameterInfo.prototype.state = 0; + + /** + * ParameterInfo value. + * @member {google.protobuf.IValue|null|undefined} value + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @instance + */ + ParameterInfo.prototype.value = null; + + /** + * ParameterInfo justCollected. + * @member {boolean} justCollected + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @instance + */ + ParameterInfo.prototype.justCollected = false; + + /** + * Creates a new ParameterInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo} ParameterInfo instance + */ + ParameterInfo.create = function create(properties) { + return new ParameterInfo(properties); + }; + + /** + * Encodes the specified ParameterInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo} message ParameterInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ParameterInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.required != null && Object.hasOwnProperty.call(message, "required")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.required); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.google.protobuf.Value.encode(message.value, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.justCollected != null && Object.hasOwnProperty.call(message, "justCollected")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.justCollected); + return writer; + }; + + /** + * Encodes the specified ParameterInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.IParameterInfo} message ParameterInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ParameterInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ParameterInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @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.PageInfo.FormInfo.ParameterInfo} ParameterInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ParameterInfo.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.PageInfo.FormInfo.ParameterInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + message.required = reader.bool(); + break; + case 3: + message.state = reader.int32(); + break; + case 4: + message.value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + case 5: + message.justCollected = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ParameterInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo} ParameterInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ParameterInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ParameterInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ParameterInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.required != null && message.hasOwnProperty("required")) + if (typeof message.required !== "boolean") + return "required: boolean expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.value != null && message.hasOwnProperty("value")) { + var error = $root.google.protobuf.Value.verify(message.value); + if (error) + return "value." + error; + } + if (message.justCollected != null && message.hasOwnProperty("justCollected")) + if (typeof message.justCollected !== "boolean") + return "justCollected: boolean expected"; + return null; + }; + + /** + * Creates a ParameterInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo} ParameterInfo + */ + ParameterInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.required != null) + message.required = Boolean(object.required); + switch (object.state) { + case "PARAMETER_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "EMPTY": + case 1: + message.state = 1; + break; + case "INVALID": + case 2: + message.state = 2; + break; + case "FILLED": + case 3: + message.state = 3; + break; + } + if (object.value != null) { + if (typeof object.value !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.value: object expected"); + message.value = $root.google.protobuf.Value.fromObject(object.value); + } + if (object.justCollected != null) + message.justCollected = Boolean(object.justCollected); + return message; + }; + + /** + * Creates a plain object from a ParameterInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo} message ParameterInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ParameterInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayName = ""; + object.required = false; + object.state = options.enums === String ? "PARAMETER_STATE_UNSPECIFIED" : 0; + object.value = null; + object.justCollected = false; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.required != null && message.hasOwnProperty("required")) + object.required = message.required; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState[message.state] : message.state; + if (message.value != null && message.hasOwnProperty("value")) + object.value = $root.google.protobuf.Value.toObject(message.value, options); + if (message.justCollected != null && message.hasOwnProperty("justCollected")) + object.justCollected = message.justCollected; + return object; + }; + + /** + * Converts this ParameterInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo + * @instance + * @returns {Object.} JSON object + */ + ParameterInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ParameterState enum. + * @name google.cloud.dialogflow.cx.v3beta1.PageInfo.FormInfo.ParameterInfo.ParameterState + * @enum {number} + * @property {number} PARAMETER_STATE_UNSPECIFIED=0 PARAMETER_STATE_UNSPECIFIED value + * @property {number} EMPTY=1 EMPTY value + * @property {number} INVALID=2 INVALID value + * @property {number} FILLED=3 FILLED value + */ + ParameterInfo.ParameterState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PARAMETER_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "EMPTY"] = 1; + values[valuesById[2] = "INVALID"] = 2; + values[valuesById[3] = "FILLED"] = 3; + return values; + })(); + + return ParameterInfo; + })(); + + return FormInfo; + })(); + + return PageInfo; + })(); + + v3beta1.SessionInfo = (function() { + + /** + * Properties of a SessionInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @interface ISessionInfo + * @property {string|null} [session] SessionInfo session + * @property {Object.|null} [parameters] SessionInfo parameters + */ + + /** + * Constructs a new SessionInfo. + * @memberof google.cloud.dialogflow.cx.v3beta1 + * @classdesc Represents a SessionInfo. + * @implements ISessionInfo + * @constructor + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionInfo=} [properties] Properties to set + */ + function SessionInfo(properties) { + this.parameters = {}; + 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]]; + } + + /** + * SessionInfo session. + * @member {string} session + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @instance + */ + SessionInfo.prototype.session = ""; + + /** + * SessionInfo parameters. + * @member {Object.} parameters + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @instance + */ + SessionInfo.prototype.parameters = $util.emptyObject; + + /** + * Creates a new SessionInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3beta1.SessionInfo} SessionInfo instance + */ + SessionInfo.create = function create(properties) { + return new SessionInfo(properties); + }; + + /** + * Encodes the specified SessionInfo message. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionInfo} message SessionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + for (var keys = Object.keys(message.parameters), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.parameters[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified SessionInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3beta1.SessionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.ISessionInfo} message SessionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SessionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @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.SessionInfo} SessionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionInfo.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.SessionInfo(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.session = reader.string(); + break; + case 2: + if (message.parameters === $util.emptyObject) + message.parameters = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.parameters[key] = value; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SessionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3beta1.SessionInfo} SessionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SessionInfo message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SessionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (!$util.isObject(message.parameters)) + return "parameters: object expected"; + var key = Object.keys(message.parameters); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.parameters[key[i]]); + if (error) + return "parameters." + error; + } + } + return null; + }; + + /** + * Creates a SessionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3beta1.SessionInfo} SessionInfo + */ + SessionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3beta1.SessionInfo(); + if (object.session != null) + message.session = String(object.session); + if (object.parameters) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters: object expected"); + message.parameters = {}; + for (var keys = Object.keys(object.parameters), i = 0; i < keys.length; ++i) { + if (typeof object.parameters[keys[i]] !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3beta1.SessionInfo.parameters: object expected"); + message.parameters[keys[i]] = $root.google.protobuf.Value.fromObject(object.parameters[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a SessionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @static + * @param {google.cloud.dialogflow.cx.v3beta1.SessionInfo} message SessionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SessionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.parameters = {}; + if (options.defaults) + object.session = ""; + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + var keys2; + if (message.parameters && (keys2 = Object.keys(message.parameters)).length) { + object.parameters = {}; + for (var j = 0; j < keys2.length; ++j) + object.parameters[keys2[j]] = $root.google.protobuf.Value.toObject(message.parameters[keys2[j]], options); + } + return object; + }; + + /** + * Converts this SessionInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3beta1.SessionInfo + * @instance + * @returns {Object.} JSON object + */ + SessionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SessionInfo; + })(); + + return v3beta1; + })(); + return cx; })(); diff --git a/protos/protos.json b/protos/protos.json index 9bc62bf4..9f97a199 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -4654,6 +4654,4387 @@ } } } + }, + "v3beta1": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Dialogflow.Cx.V3Beta1", + "go_package": "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1;cx", + "java_multiple_files": true, + "java_outer_classname": "WebhookProto", + "java_package": "com.google.cloud.dialogflow.cx.v3beta1", + "objc_class_prefix": "DF", + "(google.api.resource_definition).type": "dialogflow.googleapis.com/Session", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}" + }, + "nested": { + "Agents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListAgents": { + "requestType": "ListAgentsRequest", + "responseType": "ListAgentsResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*}/agents", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*}/agents" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetAgent": { + "requestType": "GetAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateAgent": { + "requestType": "CreateAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*}/agents", + "(google.api.http).body": "agent", + "(google.api.method_signature)": "parent,agent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*}/agents", + "body": "agent" + } + }, + { + "(google.api.method_signature)": "parent,agent" + } + ] + }, + "UpdateAgent": { + "requestType": "UpdateAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).patch": "/v3beta1/{agent.name=projects/*/locations/*/agents/*}", + "(google.api.http).body": "agent", + "(google.api.method_signature)": "agent,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{agent.name=projects/*/locations/*/agents/*}", + "body": "agent" + } + }, + { + "(google.api.method_signature)": "agent,update_mask" + } + ] + }, + "DeleteAgent": { + "requestType": "DeleteAgentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ExportAgent": { + "requestType": "ExportAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{name=projects/*/locations/*/agents/*}:export", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "ExportAgentResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{name=projects/*/locations/*/agents/*}:export", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ExportAgentResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "RestoreAgent": { + "requestType": "RestoreAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{name=projects/*/locations/*/agents/*}:restore", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{name=projects/*/locations/*/agents/*}:restore", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "SpeechToTextSettings": { + "fields": { + "enableSpeechAdaptation": { + "type": "bool", + "id": 1 + } + } + }, + "Agent": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Agent", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "defaultLanguageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "timeZone": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 6 + }, + "avatarUri": { + "type": "string", + "id": 7 + }, + "speechToTextSettings": { + "type": "SpeechToTextSettings", + "id": 13 + }, + "startFlow": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "IMMUTABLE", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + }, + "enableStackdriverLogging": { + "type": "bool", + "id": 18 + }, + "enableSpellCorrection": { + "type": "bool", + "id": 20 + } + } + }, + "ListAgentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListAgentsResponse": { + "fields": { + "agents": { + "rule": "repeated", + "type": "Agent", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetAgentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "CreateAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agent": { + "type": "Agent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateAgentRequest": { + "fields": { + "agent": { + "type": "Agent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteAgentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "ExportAgentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExportAgentResponse": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "agentUri": { + "type": "string", + "id": 1 + }, + "agentContent": { + "type": "bytes", + "id": 2 + } + } + }, + "RestoreAgentRequest": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2 + }, + "agentContent": { + "type": "bytes", + "id": 3 + } + } + }, + "Flows": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateFlow": { + "requestType": "CreateFlowRequest", + "responseType": "Flow", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows", + "(google.api.http).body": "flow", + "(google.api.method_signature)": "parent,flow" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows", + "body": "flow" + } + }, + { + "(google.api.method_signature)": "parent,flow" + } + ] + }, + "DeleteFlow": { + "requestType": "DeleteFlowRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListFlows": { + "requestType": "ListFlowsRequest", + "responseType": "ListFlowsResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/flows" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetFlow": { + "requestType": "GetFlowRequest", + "responseType": "Flow", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateFlow": { + "requestType": "UpdateFlowRequest", + "responseType": "Flow", + "options": { + "(google.api.http).patch": "/v3beta1/{flow.name=projects/*/locations/*/agents/*/flows/*}", + "(google.api.http).body": "flow", + "(google.api.method_signature)": "flow,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{flow.name=projects/*/locations/*/agents/*/flows/*}", + "body": "flow" + } + }, + { + "(google.api.method_signature)": "flow,update_mask" + } + ] + }, + "TrainFlow": { + "requestType": "TrainFlowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}:train", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*}:train", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "NluSettings": { + "fields": { + "modelType": { + "type": "ModelType", + "id": 1 + }, + "classificationThreshold": { + "type": "float", + "id": 3 + }, + "modelTrainingMode": { + "type": "ModelTrainingMode", + "id": 4 + } + }, + "nested": { + "ModelType": { + "values": { + "MODEL_TYPE_UNSPECIFIED": 0, + "MODEL_TYPE_STANDARD": 1, + "MODEL_TYPE_ADVANCED": 3 + } + }, + "ModelTrainingMode": { + "values": { + "MODEL_TRAINING_MODE_UNSPECIFIED": 0, + "MODEL_TRAINING_MODE_AUTOMATIC": 1, + "MODEL_TRAINING_MODE_MANUAL": 2 + } + } + } + }, + "Flow": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Flow", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 3 + }, + "transitionRoutes": { + "rule": "repeated", + "type": "TransitionRoute", + "id": 4 + }, + "eventHandlers": { + "rule": "repeated", + "type": "EventHandler", + "id": 10 + }, + "nluSettings": { + "type": "NluSettings", + "id": 11 + } + } + }, + "CreateFlowRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Flow" + } + }, + "flow": { + "type": "Flow", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "DeleteFlowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + }, + "force": { + "type": "bool", + "id": 2 + } + } + }, + "ListFlowsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Flow" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "languageCode": { + "type": "string", + "id": 4 + } + } + }, + "ListFlowsResponse": { + "fields": { + "flows": { + "rule": "repeated", + "type": "Flow", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetFlowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + }, + "languageCode": { + "type": "string", + "id": 2 + } + } + }, + "UpdateFlowRequest": { + "fields": { + "flow": { + "type": "Flow", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "TrainFlowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + } + } + }, + "Pages": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListPages": { + "requestType": "ListPagesRequest", + "responseType": "ListPagesResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/pages", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/pages" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetPage": { + "requestType": "GetPageRequest", + "responseType": "Page", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/pages/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/pages/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreatePage": { + "requestType": "CreatePageRequest", + "responseType": "Page", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/pages", + "(google.api.http).body": "page", + "(google.api.method_signature)": "parent,page" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/pages", + "body": "page" + } + }, + { + "(google.api.method_signature)": "parent,page" + } + ] + }, + "UpdatePage": { + "requestType": "UpdatePageRequest", + "responseType": "Page", + "options": { + "(google.api.http).patch": "/v3beta1/{page.name=projects/*/locations/*/agents/*/flows/*/pages/*}", + "(google.api.http).body": "page", + "(google.api.method_signature)": "page,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{page.name=projects/*/locations/*/agents/*/flows/*/pages/*}", + "body": "page" + } + }, + { + "(google.api.method_signature)": "page,update_mask" + } + ] + }, + "DeletePage": { + "requestType": "DeletePageRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/pages/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/pages/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "Page": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Page", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "entryFulfillment": { + "type": "Fulfillment", + "id": 7 + }, + "form": { + "type": "Form", + "id": 4 + }, + "transitionRouteGroups": { + "rule": "repeated", + "type": "string", + "id": 11, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/TransitionRouteGroup" + } + }, + "transitionRoutes": { + "rule": "repeated", + "type": "TransitionRoute", + "id": 9 + }, + "eventHandlers": { + "rule": "repeated", + "type": "EventHandler", + "id": 10 + } + } + }, + "Form": { + "fields": { + "parameters": { + "rule": "repeated", + "type": "Parameter", + "id": 1 + } + }, + "nested": { + "Parameter": { + "fields": { + "displayName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "required": { + "type": "bool", + "id": 2 + }, + "entityType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "isList": { + "type": "bool", + "id": 4 + }, + "fillBehavior": { + "type": "FillBehavior", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "defaultValue": { + "type": "google.protobuf.Value", + "id": 9 + }, + "redact": { + "type": "bool", + "id": 11 + } + }, + "nested": { + "FillBehavior": { + "fields": { + "initialPromptFulfillment": { + "type": "Fulfillment", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "repromptEventHandlers": { + "rule": "repeated", + "type": "EventHandler", + "id": 5 + } + } + } + } + } + } + }, + "EventHandler": { + "oneofs": { + "target": { + "oneof": [ + "targetPage", + "targetFlow" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "event": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "triggerFulfillment": { + "type": "Fulfillment", + "id": 5 + }, + "targetPage": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Page" + } + }, + "targetFlow": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + } + } + }, + "TransitionRoute": { + "oneofs": { + "target": { + "oneof": [ + "targetPage", + "targetFlow" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "intent": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + }, + "condition": { + "type": "string", + "id": 2 + }, + "triggerFulfillment": { + "type": "Fulfillment", + "id": 3 + }, + "targetPage": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Page" + } + }, + "targetFlow": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + } + } + }, + "ListPagesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Page" + } + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListPagesResponse": { + "fields": { + "pages": { + "rule": "repeated", + "type": "Page", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetPageRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Page" + } + }, + "languageCode": { + "type": "string", + "id": 2 + } + } + }, + "CreatePageRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Page" + } + }, + "page": { + "type": "Page", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "UpdatePageRequest": { + "fields": { + "page": { + "type": "Page", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, + "DeletePageRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Page" + } + }, + "force": { + "type": "bool", + "id": 2 + } + } + }, + "Fulfillment": { + "fields": { + "messages": { + "rule": "repeated", + "type": "ResponseMessage", + "id": 1 + }, + "webhook": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Webhook" + } + }, + "tag": { + "type": "string", + "id": 3 + }, + "setParameterActions": { + "rule": "repeated", + "type": "SetParameterAction", + "id": 4 + }, + "conditionalCases": { + "rule": "repeated", + "type": "ConditionalCases", + "id": 5 + } + }, + "nested": { + "SetParameterAction": { + "fields": { + "parameter": { + "type": "string", + "id": 1 + }, + "value": { + "type": "google.protobuf.Value", + "id": 2 + } + } + }, + "ConditionalCases": { + "fields": { + "cases": { + "rule": "repeated", + "type": "Case", + "id": 1 + } + }, + "nested": { + "Case": { + "fields": { + "condition": { + "type": "string", + "id": 1 + }, + "caseContent": { + "rule": "repeated", + "type": "CaseContent", + "id": 2 + } + }, + "nested": { + "CaseContent": { + "oneofs": { + "casesOrMessage": { + "oneof": [ + "message", + "additionalCases" + ] + } + }, + "fields": { + "message": { + "type": "ResponseMessage", + "id": 1 + }, + "additionalCases": { + "type": "ConditionalCases", + "id": 2 + } + } + } + } + } + } + } + } + }, + "ResponseMessage": { + "oneofs": { + "message": { + "oneof": [ + "text", + "payload", + "conversationSuccess", + "outputAudioText", + "liveAgentHandoff", + "endInteraction", + "playAudio", + "mixedAudio" + ] + } + }, + "fields": { + "text": { + "type": "Text", + "id": 1 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 2 + }, + "conversationSuccess": { + "type": "ConversationSuccess", + "id": 9 + }, + "outputAudioText": { + "type": "OutputAudioText", + "id": 8 + }, + "liveAgentHandoff": { + "type": "LiveAgentHandoff", + "id": 10 + }, + "endInteraction": { + "type": "EndInteraction", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "playAudio": { + "type": "PlayAudio", + "id": 12 + }, + "mixedAudio": { + "type": "MixedAudio", + "id": 13, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Text": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "allowPlaybackInterruption": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "LiveAgentHandoff": { + "fields": { + "metadata": { + "type": "google.protobuf.Struct", + "id": 1 + } + } + }, + "ConversationSuccess": { + "fields": { + "metadata": { + "type": "google.protobuf.Struct", + "id": 1 + } + } + }, + "OutputAudioText": { + "oneofs": { + "source": { + "oneof": [ + "text", + "ssml" + ] + } + }, + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "ssml": { + "type": "string", + "id": 2 + }, + "allowPlaybackInterruption": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "MixedAudio": { + "fields": { + "segments": { + "rule": "repeated", + "type": "Segment", + "id": 1 + } + }, + "nested": { + "Segment": { + "oneofs": { + "content": { + "oneof": [ + "audio", + "uri" + ] + } + }, + "fields": { + "audio": { + "type": "bytes", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + }, + "allowPlaybackInterruption": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + } + } + }, + "EndInteraction": { + "fields": {} + }, + "PlayAudio": { + "fields": { + "audioUri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "allowPlaybackInterruption": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + } + } + }, + "SpeechWordInfo": { + "fields": { + "word": { + "type": "string", + "id": 3 + }, + "startOffset": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "endOffset": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "confidence": { + "type": "float", + "id": 4 + } + } + }, + "AudioEncoding": { + "values": { + "AUDIO_ENCODING_UNSPECIFIED": 0, + "AUDIO_ENCODING_LINEAR_16": 1, + "AUDIO_ENCODING_FLAC": 2, + "AUDIO_ENCODING_MULAW": 3, + "AUDIO_ENCODING_AMR": 4, + "AUDIO_ENCODING_AMR_WB": 5, + "AUDIO_ENCODING_OGG_OPUS": 6, + "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 + } + }, + "InputAudioConfig": { + "fields": { + "audioEncoding": { + "type": "AudioEncoding", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sampleRateHertz": { + "type": "int32", + "id": 2 + }, + "enableWordInfo": { + "type": "bool", + "id": 13 + }, + "phraseHints": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "model": { + "type": "string", + "id": 7 + }, + "modelVariant": { + "type": "SpeechModelVariant", + "id": 10 + }, + "singleUtterance": { + "type": "bool", + "id": 8 + } + } + }, + "SpeechModelVariant": { + "values": { + "SPEECH_MODEL_VARIANT_UNSPECIFIED": 0, + "USE_BEST_AVAILABLE": 1, + "USE_STANDARD": 2, + "USE_ENHANCED": 3 + } + }, + "VoiceSelectionParams": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "ssmlGender": { + "type": "SsmlVoiceGender", + "id": 2 + } + } + }, + "SynthesizeSpeechConfig": { + "fields": { + "speakingRate": { + "type": "double", + "id": 1 + }, + "pitch": { + "type": "double", + "id": 2 + }, + "volumeGainDb": { + "type": "double", + "id": 3 + }, + "effectsProfileId": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "voice": { + "type": "VoiceSelectionParams", + "id": 4 + } + } + }, + "SsmlVoiceGender": { + "values": { + "SSML_VOICE_GENDER_UNSPECIFIED": 0, + "SSML_VOICE_GENDER_MALE": 1, + "SSML_VOICE_GENDER_FEMALE": 2, + "SSML_VOICE_GENDER_NEUTRAL": 3 + } + }, + "OutputAudioConfig": { + "fields": { + "audioEncoding": { + "type": "OutputAudioEncoding", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sampleRateHertz": { + "type": "int32", + "id": 2 + }, + "synthesizeSpeechConfig": { + "type": "SynthesizeSpeechConfig", + "id": 3 + } + } + }, + "OutputAudioEncoding": { + "values": { + "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": 0, + "OUTPUT_AUDIO_ENCODING_LINEAR_16": 1, + "OUTPUT_AUDIO_ENCODING_MP3": 2, + "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": 4, + "OUTPUT_AUDIO_ENCODING_OGG_OPUS": 3, + "OUTPUT_AUDIO_ENCODING_MULAW": 5 + } + }, + "EntityTypes": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListEntityTypes": { + "requestType": "ListEntityTypesRequest", + "responseType": "ListEntityTypesResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetEntityType": { + "requestType": "GetEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/entityTypes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateEntityType": { + "requestType": "CreateEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes", + "(google.api.http).body": "entity_type", + "(google.api.method_signature)": "parent,entity_type" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/entityTypes", + "body": "entity_type" + } + }, + { + "(google.api.method_signature)": "parent,entity_type" + } + ] + }, + "UpdateEntityType": { + "requestType": "UpdateEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).patch": "/v3beta1/{entity_type.name=projects/*/locations/*/agents/*/entityTypes/*}", + "(google.api.http).body": "entity_type", + "(google.api.method_signature)": "entity_type,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{entity_type.name=projects/*/locations/*/agents/*/entityTypes/*}", + "body": "entity_type" + } + }, + { + "(google.api.method_signature)": "entity_type,update_mask" + } + ] + }, + "DeleteEntityType": { + "requestType": "DeleteEntityTypeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/entityTypes/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "EntityType": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/EntityType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "kind": { + "type": "Kind", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "autoExpansionMode": { + "type": "AutoExpansionMode", + "id": 4 + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 5 + }, + "excludedPhrases": { + "rule": "repeated", + "type": "ExcludedPhrase", + "id": 6 + }, + "enableFuzzyExtraction": { + "type": "bool", + "id": 7 + } + }, + "nested": { + "Entity": { + "fields": { + "value": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ExcludedPhrase": { + "fields": { + "value": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "Kind": { + "values": { + "KIND_UNSPECIFIED": 0, + "KIND_MAP": 1, + "KIND_LIST": 2, + "KIND_REGEXP": 3 + } + }, + "AutoExpansionMode": { + "values": { + "AUTO_EXPANSION_MODE_UNSPECIFIED": 0, + "AUTO_EXPANSION_MODE_DEFAULT": 1 + } + } + } + }, + "ListEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListEntityTypesResponse": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "languageCode": { + "type": "string", + "id": 2 + } + } + }, + "CreateEntityTypeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityType": { + "type": "EntityType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "UpdateEntityTypeRequest": { + "fields": { + "entityType": { + "type": "EntityType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, + "DeleteEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "force": { + "type": "bool", + "id": 2 + } + } + }, + "Environments": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListEnvironments": { + "requestType": "ListEnvironmentsRequest", + "responseType": "ListEnvironmentsResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/environments", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/environments" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetEnvironment": { + "requestType": "GetEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateEnvironment": { + "requestType": "CreateEnvironmentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/environments", + "(google.api.http).body": "environment", + "(google.api.method_signature)": "parent,environment", + "(google.longrunning.operation_info).response_type": "Environment", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/environments", + "body": "environment" + } + }, + { + "(google.api.method_signature)": "parent,environment" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Environment", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "UpdateEnvironment": { + "requestType": "UpdateEnvironmentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v3beta1/{environment.name=projects/*/locations/*/agents/*/environments/*}", + "(google.api.http).body": "environment", + "(google.api.method_signature)": "environment,update_mask", + "(google.longrunning.operation_info).response_type": "Environment", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{environment.name=projects/*/locations/*/agents/*/environments/*}", + "body": "environment" + } + }, + { + "(google.api.method_signature)": "environment,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Environment", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "DeleteEnvironment": { + "requestType": "DeleteEnvironmentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "LookupEnvironmentHistory": { + "requestType": "LookupEnvironmentHistoryRequest", + "responseType": "LookupEnvironmentHistoryResponse", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}:lookupEnvironmentHistory", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*}:lookupEnvironmentHistory" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "Environment": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Environment", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 3 + }, + "versionConfigs": { + "rule": "repeated", + "type": "VersionConfig", + "id": 6, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VersionConfig": { + "fields": { + "version": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + } + } + }, + "ListEnvironmentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Environment" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListEnvironmentsResponse": { + "fields": { + "environments": { + "rule": "repeated", + "type": "Environment", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetEnvironmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + } + } + }, + "CreateEnvironmentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Environment" + } + }, + "environment": { + "type": "Environment", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateEnvironmentRequest": { + "fields": { + "environment": { + "type": "Environment", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteEnvironmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + } + } + }, + "LookupEnvironmentHistoryRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "LookupEnvironmentHistoryResponse": { + "fields": { + "environments": { + "rule": "repeated", + "type": "Environment", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "Intents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListIntents": { + "requestType": "ListIntentsRequest", + "responseType": "ListIntentsResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/intents", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/intents" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetIntent": { + "requestType": "GetIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/intents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/intents/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateIntent": { + "requestType": "CreateIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/intents", + "(google.api.http).body": "intent", + "(google.api.method_signature)": "parent,intent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/intents", + "body": "intent" + } + }, + { + "(google.api.method_signature)": "parent,intent" + } + ] + }, + "UpdateIntent": { + "requestType": "UpdateIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).patch": "/v3beta1/{intent.name=projects/*/locations/*/agents/*/intents/*}", + "(google.api.http).body": "intent", + "(google.api.method_signature)": "intent,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{intent.name=projects/*/locations/*/agents/*/intents/*}", + "body": "intent" + } + }, + { + "(google.api.method_signature)": "intent,update_mask" + } + ] + }, + "DeleteIntent": { + "requestType": "DeleteIntentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/intents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/intents/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "Intent": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Intent", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "trainingPhrases": { + "rule": "repeated", + "type": "TrainingPhrase", + "id": 3 + }, + "parameters": { + "rule": "repeated", + "type": "Parameter", + "id": 4 + }, + "priority": { + "type": "int32", + "id": 5 + }, + "isFallback": { + "type": "bool", + "id": 6 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "description": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "TrainingPhrase": { + "fields": { + "id": { + "type": "string", + "id": 1 + }, + "parts": { + "rule": "repeated", + "type": "Part", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "repeatCount": { + "type": "int32", + "id": 3 + } + }, + "nested": { + "Part": { + "fields": { + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parameterId": { + "type": "string", + "id": 2 + } + } + } + } + }, + "Parameter": { + "fields": { + "id": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "entityType": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "isList": { + "type": "bool", + "id": 3 + }, + "redact": { + "type": "bool", + "id": 4 + } + } + } + } + }, + "ListIntentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "intentView": { + "type": "IntentView", + "id": 5 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListIntentsResponse": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetIntentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + }, + "languageCode": { + "type": "string", + "id": 2 + } + } + }, + "CreateIntentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intent": { + "type": "Intent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "UpdateIntentRequest": { + "fields": { + "intent": { + "type": "Intent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, + "DeleteIntentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + } + } + }, + "IntentView": { + "values": { + "INTENT_VIEW_UNSPECIFIED": 0, + "INTENT_VIEW_PARTIAL": 1, + "INTENT_VIEW_FULL": 2 + } + }, + "Sessions": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "DetectIntent": { + "requestType": "DetectIntentRequest", + "responseType": "DetectIntentResponse", + "options": { + "(google.api.http).post": "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:detectIntent", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:detectIntent", + "body": "*", + "additional_bindings": { + "post": "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:detectIntent", + "body": "*" + } + } + } + ] + }, + "StreamingDetectIntent": { + "requestType": "StreamingDetectIntentRequest", + "requestStream": true, + "responseType": "StreamingDetectIntentResponse", + "responseStream": true + }, + "MatchIntent": { + "requestType": "MatchIntentRequest", + "responseType": "MatchIntentResponse", + "options": { + "(google.api.http).post": "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:matchIntent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:matchIntent", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{session=projects/*/locations/*/agents/*/sessions/*}:matchIntent", + "body": "*", + "additional_bindings": { + "post": "/v3beta1/{session=projects/*/locations/*/agents/*/environments/*/sessions/*}:matchIntent", + "body": "*" + } + } + } + ] + }, + "FulfillIntent": { + "requestType": "FulfillIntentRequest", + "responseType": "FulfillIntentResponse", + "options": { + "(google.api.http).post": "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/sessions/*}:fulfillIntent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/environments/*/sessions/*}:fulfillIntent", + "(google.api.http).additional_bindings.body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/sessions/*}:fulfillIntent", + "body": "*", + "additional_bindings": { + "post": "/v3beta1/{match_intent_request.session=projects/*/locations/*/agents/*/environments/*/sessions/*}:fulfillIntent", + "body": "*" + } + } + } + ] + } + } + }, + "DetectIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + } + } + }, + "DetectIntentResponse": { + "fields": { + "responseId": { + "type": "string", + "id": 1 + }, + "queryResult": { + "type": "QueryResult", + "id": 2 + }, + "outputAudio": { + "type": "bytes", + "id": 4 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 5 + } + } + }, + "StreamingDetectIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + } + } + }, + "StreamingDetectIntentResponse": { + "oneofs": { + "response": { + "oneof": [ + "recognitionResult", + "detectIntentResponse" + ] + } + }, + "fields": { + "recognitionResult": { + "type": "StreamingRecognitionResult", + "id": 1 + }, + "detectIntentResponse": { + "type": "DetectIntentResponse", + "id": 2 + } + } + }, + "StreamingRecognitionResult": { + "fields": { + "messageType": { + "type": "MessageType", + "id": 1 + }, + "transcript": { + "type": "string", + "id": 2 + }, + "isFinal": { + "type": "bool", + "id": 3 + }, + "confidence": { + "type": "float", + "id": 4 + }, + "stability": { + "type": "float", + "id": 6 + }, + "speechWordInfo": { + "rule": "repeated", + "type": "SpeechWordInfo", + "id": 7 + }, + "speechEndOffset": { + "type": "google.protobuf.Duration", + "id": 8 + } + }, + "nested": { + "MessageType": { + "values": { + "MESSAGE_TYPE_UNSPECIFIED": 0, + "TRANSCRIPT": 1, + "END_OF_SINGLE_UTTERANCE": 2 + } + } + } + }, + "QueryParameters": { + "fields": { + "timeZone": { + "type": "string", + "id": 1 + }, + "geoLocation": { + "type": "google.type.LatLng", + "id": 2 + }, + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 3 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 4 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 5 + }, + "analyzeQueryTextSentiment": { + "type": "bool", + "id": 8 + } + } + }, + "QueryInput": { + "oneofs": { + "input": { + "oneof": [ + "text", + "intent", + "audio", + "event", + "dtmf" + ] + } + }, + "fields": { + "text": { + "type": "TextInput", + "id": 2 + }, + "intent": { + "type": "IntentInput", + "id": 3 + }, + "audio": { + "type": "AudioInput", + "id": 5 + }, + "event": { + "type": "EventInput", + "id": 6 + }, + "dtmf": { + "type": "DtmfInput", + "id": 7 + }, + "languageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "QueryResult": { + "oneofs": { + "query": { + "oneof": [ + "text", + "triggerIntent", + "transcript", + "triggerEvent" + ] + } + }, + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "triggerIntent": { + "type": "string", + "id": 11 + }, + "transcript": { + "type": "string", + "id": 12 + }, + "triggerEvent": { + "type": "string", + "id": 14 + }, + "languageCode": { + "type": "string", + "id": 2 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 3 + }, + "responseMessages": { + "rule": "repeated", + "type": "ResponseMessage", + "id": 4 + }, + "webhookStatuses": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 13 + }, + "webhookPayloads": { + "rule": "repeated", + "type": "google.protobuf.Struct", + "id": 6 + }, + "currentPage": { + "type": "Page", + "id": 7 + }, + "intent": { + "type": "Intent", + "id": 8, + "options": { + "deprecated": true + } + }, + "intentDetectionConfidence": { + "type": "float", + "id": 9, + "options": { + "deprecated": true + } + }, + "match": { + "type": "Match", + "id": 15 + }, + "diagnosticInfo": { + "type": "google.protobuf.Struct", + "id": 10 + }, + "sentimentAnalysisResult": { + "type": "SentimentAnalysisResult", + "id": 17 + } + } + }, + "TextInput": { + "fields": { + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "IntentInput": { + "fields": { + "intent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + } + } + }, + "AudioInput": { + "fields": { + "config": { + "type": "InputAudioConfig", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "audio": { + "type": "bytes", + "id": 2 + } + } + }, + "EventInput": { + "fields": { + "event": { + "type": "string", + "id": 1 + } + } + }, + "DtmfInput": { + "fields": { + "digits": { + "type": "string", + "id": 1 + }, + "finishDigit": { + "type": "string", + "id": 2 + } + } + }, + "Match": { + "fields": { + "intent": { + "type": "Intent", + "id": 1 + }, + "event": { + "type": "string", + "id": 6 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 2 + }, + "resolvedInput": { + "type": "string", + "id": 3 + }, + "matchType": { + "type": "MatchType", + "id": 4 + }, + "confidence": { + "type": "float", + "id": 5 + } + }, + "nested": { + "MatchType": { + "values": { + "MATCH_TYPE_UNSPECIFIED": 0, + "INTENT": 1, + "DIRECT_INTENT": 2, + "PARAMETER_FILLING": 3, + "NO_MATCH": 4, + "NO_INPUT": 5, + "EVENT": 6 + } + } + } + }, + "MatchIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "MatchIntentResponse": { + "oneofs": { + "query": { + "oneof": [ + "text", + "triggerIntent", + "transcript", + "triggerEvent" + ] + } + }, + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "triggerIntent": { + "type": "string", + "id": 2 + }, + "transcript": { + "type": "string", + "id": 3 + }, + "triggerEvent": { + "type": "string", + "id": 6 + }, + "matches": { + "rule": "repeated", + "type": "Match", + "id": 4 + }, + "currentPage": { + "type": "Page", + "id": 5 + } + } + }, + "FulfillIntentRequest": { + "fields": { + "matchIntentRequest": { + "type": "MatchIntentRequest", + "id": 1 + }, + "match": { + "type": "Match", + "id": 2 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 3 + } + } + }, + "FulfillIntentResponse": { + "fields": { + "responseId": { + "type": "string", + "id": 1 + }, + "queryResult": { + "type": "QueryResult", + "id": 2 + }, + "outputAudio": { + "type": "bytes", + "id": 3 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + } + } + }, + "SentimentAnalysisResult": { + "fields": { + "score": { + "type": "float", + "id": 1 + }, + "magnitude": { + "type": "float", + "id": 2 + } + } + }, + "SessionEntityTypes": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListSessionEntityTypes": { + "requestType": "ListSessionEntityTypesRequest", + "responseType": "ListSessionEntityTypesResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*/sessions/*}/entityTypes", + "(google.api.http).additional_bindings.get": "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*/sessions/*}/entityTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*/sessions/*}/entityTypes", + "additional_bindings": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*/sessions/*}/entityTypes" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSessionEntityType": { + "requestType": "GetSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.get": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}", + "additional_bindings": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSessionEntityType": { + "requestType": "CreateSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*/sessions/*}/entityTypes", + "(google.api.http).body": "session_entity_type", + "(google.api.http).additional_bindings.post": "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*/sessions/*}/entityTypes", + "(google.api.http).additional_bindings.body": "session_entity_type", + "(google.api.method_signature)": "parent,session_entity_type" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*/sessions/*}/entityTypes", + "body": "session_entity_type", + "additional_bindings": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*/environments/*/sessions/*}/entityTypes", + "body": "session_entity_type" + } + } + }, + { + "(google.api.method_signature)": "parent,session_entity_type" + } + ] + }, + "UpdateSessionEntityType": { + "requestType": "UpdateSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).patch": "/v3beta1/{session_entity_type.name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}", + "(google.api.http).body": "session_entity_type", + "(google.api.http).additional_bindings.patch": "/v3beta1/{session_entity_type.name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.body": "session_entity_type", + "(google.api.method_signature)": "session_entity_type,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{session_entity_type.name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}", + "body": "session_entity_type", + "additional_bindings": { + "patch": "/v3beta1/{session_entity_type.name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}", + "body": "session_entity_type" + } + } + }, + { + "(google.api.method_signature)": "session_entity_type,update_mask" + } + ] + }, + "DeleteSessionEntityType": { + "requestType": "DeleteSessionEntityTypeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.delete": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/sessions/*/entityTypes/*}", + "additional_bindings": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/environments/*/sessions/*/entityTypes/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "SessionEntityType": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/SessionEntityType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "entityOverrideMode": { + "type": "EntityOverrideMode", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "EntityOverrideMode": { + "values": { + "ENTITY_OVERRIDE_MODE_UNSPECIFIED": 0, + "ENTITY_OVERRIDE_MODE_OVERRIDE": 1, + "ENTITY_OVERRIDE_MODE_SUPPLEMENT": 2 + } + } + } + }, + "ListSessionEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/SessionEntityType" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListSessionEntityTypesResponse": { + "fields": { + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetSessionEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/SessionEntityType" + } + } + } + }, + "CreateSessionEntityTypeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/SessionEntityType" + } + }, + "sessionEntityType": { + "type": "SessionEntityType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateSessionEntityTypeRequest": { + "fields": { + "sessionEntityType": { + "type": "SessionEntityType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteSessionEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/SessionEntityType" + } + } + } + }, + "TransitionRouteGroups": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListTransitionRouteGroups": { + "requestType": "ListTransitionRouteGroupsRequest", + "responseType": "ListTransitionRouteGroupsResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetTransitionRouteGroup": { + "requestType": "GetTransitionRouteGroupRequest", + "responseType": "TransitionRouteGroup", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateTransitionRouteGroup": { + "requestType": "CreateTransitionRouteGroupRequest", + "responseType": "TransitionRouteGroup", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups", + "(google.api.http).body": "transition_route_group", + "(google.api.method_signature)": "parent,transition_route_group" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups", + "body": "transition_route_group" + } + }, + { + "(google.api.method_signature)": "parent,transition_route_group" + } + ] + }, + "UpdateTransitionRouteGroup": { + "requestType": "UpdateTransitionRouteGroupRequest", + "responseType": "TransitionRouteGroup", + "options": { + "(google.api.http).patch": "/v3beta1/{transition_route_group.name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}", + "(google.api.http).body": "transition_route_group", + "(google.api.method_signature)": "transition_route_group,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{transition_route_group.name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}", + "body": "transition_route_group" + } + }, + { + "(google.api.method_signature)": "transition_route_group,update_mask" + } + ] + }, + "DeleteTransitionRouteGroup": { + "requestType": "DeleteTransitionRouteGroupRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "TransitionRouteGroup": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/TransitionRouteGroup", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "transitionRoutes": { + "rule": "repeated", + "type": "TransitionRoute", + "id": 5 + } + } + }, + "ListTransitionRouteGroupsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/TransitionRouteGroup" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "languageCode": { + "type": "string", + "id": 4 + } + } + }, + "ListTransitionRouteGroupsResponse": { + "fields": { + "transitionRouteGroups": { + "rule": "repeated", + "type": "TransitionRouteGroup", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetTransitionRouteGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/TransitionRouteGroup" + } + }, + "languageCode": { + "type": "string", + "id": 2 + } + } + }, + "CreateTransitionRouteGroupRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/TransitionRouteGroup" + } + }, + "transitionRouteGroup": { + "type": "TransitionRouteGroup", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "UpdateTransitionRouteGroupRequest": { + "fields": { + "transitionRouteGroup": { + "type": "TransitionRouteGroup", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "DeleteTransitionRouteGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/TransitionRouteGroup" + } + }, + "force": { + "type": "bool", + "id": 2 + } + } + }, + "Versions": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListVersions": { + "requestType": "ListVersionsRequest", + "responseType": "ListVersionsResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/versions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/versions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetVersion": { + "requestType": "GetVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateVersion": { + "requestType": "CreateVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/versions", + "(google.api.http).body": "version", + "(google.api.method_signature)": "parent,version", + "(google.longrunning.operation_info).response_type": "Version", + "(google.longrunning.operation_info).metadata_type": "CreateVersionOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*/flows/*}/versions", + "body": "version" + } + }, + { + "(google.api.method_signature)": "parent,version" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Version", + "metadata_type": "CreateVersionOperationMetadata" + } + } + ] + }, + "UpdateVersion": { + "requestType": "UpdateVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).patch": "/v3beta1/{version.name=projects/*/locations/*/agents/*/flows/*/versions/*}", + "(google.api.http).body": "version", + "(google.api.method_signature)": "version,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{version.name=projects/*/locations/*/agents/*/flows/*/versions/*}", + "body": "version" + } + }, + { + "(google.api.method_signature)": "version,update_mask" + } + ] + }, + "DeleteVersion": { + "requestType": "DeleteVersionRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "LoadVersion": { + "requestType": "LoadVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}:load", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{name=projects/*/locations/*/agents/*/flows/*/versions/*}:load", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "CreateVersionOperationMetadata": { + "fields": { + "version": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "Version": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Version", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 3 + }, + "nluSettings": { + "type": "NluSettings", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "RUNNING": 1, + "SUCCEEDED": 2, + "FAILED": 3 + } + } + } + }, + "ListVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Version" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListVersionsResponse": { + "fields": { + "versions": { + "rule": "repeated", + "type": "Version", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "CreateVersionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Version" + } + }, + "version": { + "type": "Version", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateVersionRequest": { + "fields": { + "version": { + "type": "Version", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "LoadVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + }, + "allowOverrideAgentResources": { + "type": "bool", + "id": 2 + } + } + }, + "Webhooks": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListWebhooks": { + "requestType": "ListWebhooksRequest", + "responseType": "ListWebhooksResponse", + "options": { + "(google.api.http).get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/webhooks", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{parent=projects/*/locations/*/agents/*}/webhooks" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetWebhook": { + "requestType": "GetWebhookRequest", + "responseType": "Webhook", + "options": { + "(google.api.http).get": "/v3beta1/{name=projects/*/locations/*/agents/*/webhooks/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3beta1/{name=projects/*/locations/*/agents/*/webhooks/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateWebhook": { + "requestType": "CreateWebhookRequest", + "responseType": "Webhook", + "options": { + "(google.api.http).post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/webhooks", + "(google.api.http).body": "webhook", + "(google.api.method_signature)": "parent,webhook" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3beta1/{parent=projects/*/locations/*/agents/*}/webhooks", + "body": "webhook" + } + }, + { + "(google.api.method_signature)": "parent,webhook" + } + ] + }, + "UpdateWebhook": { + "requestType": "UpdateWebhookRequest", + "responseType": "Webhook", + "options": { + "(google.api.http).patch": "/v3beta1/{webhook.name=projects/*/locations/*/agents/*/webhooks/*}", + "(google.api.http).body": "webhook", + "(google.api.method_signature)": "webhook,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3beta1/{webhook.name=projects/*/locations/*/agents/*/webhooks/*}", + "body": "webhook" + } + }, + { + "(google.api.method_signature)": "webhook,update_mask" + } + ] + }, + "DeleteWebhook": { + "requestType": "DeleteWebhookRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3beta1/{name=projects/*/locations/*/agents/*/webhooks/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3beta1/{name=projects/*/locations/*/agents/*/webhooks/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "Webhook": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Webhook", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}" + }, + "oneofs": { + "webhook": { + "oneof": [ + "genericWebService" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "genericWebService": { + "type": "GenericWebService", + "id": 4 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 6 + }, + "disabled": { + "type": "bool", + "id": 5 + } + }, + "nested": { + "GenericWebService": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "username": { + "type": "string", + "id": 2, + "options": { + "deprecated": true + } + }, + "password": { + "type": "string", + "id": 3, + "options": { + "deprecated": true + } + }, + "requestHeaders": { + "keyType": "string", + "type": "string", + "id": 4 + } + } + } + } + }, + "ListWebhooksRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Webhook" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListWebhooksResponse": { + "fields": { + "webhooks": { + "rule": "repeated", + "type": "Webhook", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetWebhookRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Webhook" + } + } + } + }, + "CreateWebhookRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Webhook" + } + }, + "webhook": { + "type": "Webhook", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateWebhookRequest": { + "fields": { + "webhook": { + "type": "Webhook", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteWebhookRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Webhook" + } + }, + "force": { + "type": "bool", + "id": 2 + } + } + }, + "WebhookRequest": { + "fields": { + "detectIntentResponseId": { + "type": "string", + "id": 1 + }, + "fulfillmentInfo": { + "type": "FulfillmentInfo", + "id": 6 + }, + "intentInfo": { + "type": "IntentInfo", + "id": 3 + }, + "pageInfo": { + "type": "PageInfo", + "id": 4 + }, + "sessionInfo": { + "type": "SessionInfo", + "id": 5 + }, + "messages": { + "rule": "repeated", + "type": "ResponseMessage", + "id": 7 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 8 + } + }, + "nested": { + "FulfillmentInfo": { + "fields": { + "tag": { + "type": "string", + "id": 1 + } + } + }, + "IntentInfo": { + "fields": { + "lastMatchedIntent": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + }, + "parameters": { + "keyType": "string", + "type": "IntentParameterValue", + "id": 2 + } + }, + "nested": { + "IntentParameterValue": { + "fields": { + "originalValue": { + "type": "string", + "id": 1 + }, + "resolvedValue": { + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } + } + } + }, + "WebhookResponse": { + "oneofs": { + "transition": { + "oneof": [ + "targetPage", + "targetFlow" + ] + } + }, + "fields": { + "fulfillmentResponse": { + "type": "FulfillmentResponse", + "id": 1 + }, + "pageInfo": { + "type": "PageInfo", + "id": 2 + }, + "sessionInfo": { + "type": "SessionInfo", + "id": 3 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 4 + }, + "targetPage": { + "type": "string", + "id": 5, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Page" + } + }, + "targetFlow": { + "type": "string", + "id": 6, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Flow" + } + } + }, + "nested": { + "FulfillmentResponse": { + "fields": { + "messages": { + "rule": "repeated", + "type": "ResponseMessage", + "id": 1 + }, + "mergeBehavior": { + "type": "MergeBehavior", + "id": 2 + } + }, + "nested": { + "MergeBehavior": { + "values": { + "MERGE_BEHAVIOR_UNSPECIFIED": 0, + "APPEND": 1, + "REPLACE": 2 + } + } + } + } + } + }, + "PageInfo": { + "fields": { + "currentPage": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Page" + } + }, + "formInfo": { + "type": "FormInfo", + "id": 3 + } + }, + "nested": { + "FormInfo": { + "fields": { + "parameterInfo": { + "rule": "repeated", + "type": "ParameterInfo", + "id": 2 + } + }, + "nested": { + "ParameterInfo": { + "fields": { + "displayName": { + "type": "string", + "id": 1 + }, + "required": { + "type": "bool", + "id": 2 + }, + "state": { + "type": "ParameterState", + "id": 3 + }, + "value": { + "type": "google.protobuf.Value", + "id": 4 + }, + "justCollected": { + "type": "bool", + "id": 5 + } + }, + "nested": { + "ParameterState": { + "values": { + "PARAMETER_STATE_UNSPECIFIED": 0, + "EMPTY": 1, + "INVALID": 2, + "FILLED": 3 + } + } + } + } + } + } + } + }, + "SessionInfo": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "parameters": { + "keyType": "string", + "type": "google.protobuf.Value", + "id": 2 + } + } + } + } } } } diff --git a/src/index.ts b/src/index.ts index 889a07f3..591c5f6a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** +import * as v3beta1 from './v3beta1'; import * as v3 from './v3'; const AgentsClient = v3.AgentsClient; @@ -44,6 +45,7 @@ const WebhooksClient = v3.WebhooksClient; type WebhooksClient = v3.WebhooksClient; export { + v3beta1, v3, AgentsClient, EntityTypesClient, @@ -59,6 +61,7 @@ export { WebhooksClient, }; export default { + v3beta1, v3, AgentsClient, EntityTypesClient, diff --git a/src/v3beta1/agents_client.ts b/src/v3beta1/agents_client.ts new file mode 100644 index 00000000..157ca6f5 --- /dev/null +++ b/src/v3beta1/agents_client.ts @@ -0,0 +1,2219 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/agents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './agents_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agents}. + * @class + * @memberof v3beta1 + */ +export class AgentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + agentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AgentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AgentsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listAgents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'agents' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const exportAgentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse' + ) as gax.protobuf.Type; + const exportAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const restoreAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const restoreAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + exportAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAgentResponse.decode.bind(exportAgentResponse), + exportAgentMetadata.decode.bind(exportAgentMetadata) + ), + restoreAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreAgentResponse.decode.bind(restoreAgentResponse), + restoreAgentMetadata.decode.bind(restoreAgentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Agents', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.agentsStub) { + return this.agentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Agents. + this.agentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Agents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Agents, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const agentsStubMethods = [ + 'listAgents', + 'getAgent', + 'createAgent', + 'updateAgent', + 'deleteAgent', + 'exportAgent', + 'restoreAgent', + ]; + for (const methodName of agentsStubMethods) { + const callPromise = this.agentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.agentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest | undefined, + {} | undefined + ] + >; + getAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent. + * Format: `projects//locations//agents/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.cx.v3beta1.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getAgent(request); + */ + getAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + protos.google.cloud.dialogflow.cx.v3beta1.IGetAgentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAgent(request, options, callback); + } + createAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest | undefined, + {} | undefined + ] + >; + createAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates an agent in the specified location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location to create a agent for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Agent} request.agent + * Required. The agent to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.cx.v3beta1.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createAgent(request); + */ + createAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateAgentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.createAgent(request, options, callback); + } + updateAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest | undefined, + {} | undefined + ] + >; + updateAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Agent} request.agent + * Required. The agent to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Agent]{@link google.cloud.dialogflow.cx.v3beta1.Agent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateAgent(request); + */ + updateAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent, + protos.google.cloud.dialogflow.cx.v3beta1.IUpdateAgentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'agent.name': request.agent!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAgent(request, options, callback); + } + deleteAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest | undefined, + {} | undefined + ] + >; + deleteAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent to delete. + * Format: `projects//locations//agents/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteAgent(request); + */ + deleteAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.cx.v3beta1.IDeleteAgentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAgent(request, options, callback); + } + + exportAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + exportAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Exports the specified agent to a binary file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent to export. + * Format: `projects//locations//agents/`. + * @param {string} [request.agentUri] + * Optional. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + * export the agent to. The format of this URI must be + * `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.exportAgent(request); + * const [response] = await operation.promise(); + */ + exportAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + 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.exportAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `exportAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkExportAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkExportAgentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse, + 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.exportAgent, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse, + protos.google.protobuf.Struct + >; + } + restoreAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + restoreAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + restoreAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Restores the specified agent from a binary file. + * + * Replaces the current agent with a new one. Note that all existing resources + * in agent (e.g. intents, entity types, flows) will be removed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the agent to restore into. + * Format: `projects//locations//agents/`. + * @param {string} request.agentUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to restore agent from. The format of this URI must be + * `gs:///`. + * @param {Buffer} request.agentContent + * Uncompressed raw byte content for agent. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.restoreAgent(request); + * const [response] = await operation.promise(); + */ + restoreAgent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IRestoreAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + 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.restoreAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `restoreAgent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const decodedOperation = await checkRestoreAgentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkRestoreAgentProgress( + name: string + ): Promise< + LROperation + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.restoreAgent, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + listAgents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent[], + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse + ] + >; + listAgents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IAgent + > + ): void; + listAgents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IAgent + > + ): void; + /** + * Returns the list of all agents in the specified location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Agent]{@link google.cloud.dialogflow.cx.v3beta1.Agent}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAgentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAgents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IAgent + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IAgent + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IAgent[], + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.listAgents(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Agent]{@link google.cloud.dialogflow.cx.v3beta1.Agent} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAgentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAgentsStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAgents.createStream( + this.innerApiCalls.listAgents as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listAgents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Agent]{@link google.cloud.dialogflow.cx.v3beta1.Agent}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listAgentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listAgentsAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListAgentsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAgents.asyncIterate( + this.innerApiCalls['listAgents'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.agentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/agents_client_config.json b/src/v3beta1/agents_client_config.json new file mode 100644 index 00000000..200253aa --- /dev/null +++ b/src/v3beta1/agents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Agents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListAgents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "RestoreAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/agents_proto_list.json b/src/v3beta1/agents_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/agents_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/entity_types_client.ts b/src/v3beta1/entity_types_client.ts new file mode 100644 index 00000000..4fff35a6 --- /dev/null +++ b/src/v3beta1/entity_types_client.ts @@ -0,0 +1,1985 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './entity_types_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.EntityType|EntityTypes}. + * @class + * @memberof v3beta1 + */ +export class EntityTypesClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + entityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EntityTypesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EntityTypesClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEntityTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'entityTypes' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.EntityTypes', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.entityTypesStub) { + return this.entityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.EntityTypes. + this.entityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.EntityTypes' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.EntityTypes, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const entityTypesStubMethods = [ + 'listEntityTypes', + 'getEntityType', + 'createEntityType', + 'updateEntityType', + 'deleteEntityType', + ]; + for (const methodName of entityTypesStubMethods) { + const callPromise = this.entityTypesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.entityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + getEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type. + * Format: `projects//locations//agents//entityTypes/`. + * @param {string} request.languageCode + * The language to retrieve the entity type for. The following fields are + * language dependent: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.cx.v3beta1.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getEntityType(request); + */ + getEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getEntityType(request, options, callback); + } + createEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + createEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates an entity type in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a entity type for. + * Format: `projects//locations//agents/`. + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType} request.entityType + * Required. The entity type to create. + * @param {string} request.languageCode + * The language of the following fields in `entity_type`: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.cx.v3beta1.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createEntityType(request); + */ + createEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createEntityType(request, options, callback); + } + updateEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + updateEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.EntityType} request.entityType + * Required. The entity type to update. + * @param {string} request.languageCode + * The language of the following fields in `entity_type`: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {google.protobuf.FieldMask} request.updateMask + * The mask to control which fields get updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EntityType]{@link google.cloud.dialogflow.cx.v3beta1.EntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateEntityType(request); + */ + updateEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'entity_type.name': request.entityType!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } + deleteEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + deleteEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Format: `projects//locations//agents//entityTypes/`. + * @param {boolean} request.force + * This field has no effect for entity type not being used. + * For entity types that are used by intents or pages: + * + * * If `force` is set to false, an error will be returned with message + * indicating the referencing resources. + * * If `force` is set to true, Dialogflow will remove the entity type, as + * well as any references to the entity type (i.e. Page + * {@link google.cloud.dialogflow.cx.v3beta1.Form.Parameter|parameter} of the entity type will be changed to + * '@sys.any' and intent {@link google.cloud.dialogflow.cx.v3beta1.Intent.Parameter|parameter} of the entity type + * will be removed). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteEntityType(request); + */ + deleteEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteEntityType(request, options, callback); + } + + listEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType[], + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse + ] + >; + listEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType + > + ): void; + listEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType + > + ): void; + /** + * Returns the list of all entity types in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * @param {string} request.languageCode + * The language to list entity types for. The following fields are language + * dependent: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [EntityType]{@link google.cloud.dialogflow.cx.v3beta1.EntityType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEntityType[], + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listEntityTypes(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * @param {string} request.languageCode + * The language to list entity types for. The following fields are language + * dependent: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [EntityType]{@link google.cloud.dialogflow.cx.v3beta1.EntityType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEntityTypesStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEntityTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * @param {string} request.languageCode + * The language to list entity types for. The following fields are language + * dependent: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [EntityType]{@link google.cloud.dialogflow.cx.v3beta1.EntityType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listEntityTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listEntityTypesAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListEntityTypesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.entityTypesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/entity_types_client_config.json b/src/v3beta1/entity_types_client_config.json new file mode 100644 index 00000000..fe9484a1 --- /dev/null +++ b/src/v3beta1/entity_types_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.EntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/entity_types_proto_list.json b/src/v3beta1/entity_types_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/entity_types_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/environments_client.ts b/src/v3beta1/environments_client.ts new file mode 100644 index 00000000..9ff6147d --- /dev/null +++ b/src/v3beta1/environments_client.ts @@ -0,0 +1,2246 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/environments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './environments_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environments}. + * @class + * @memberof v3beta1 + */ +export class EnvironmentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + environmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EnvironmentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EnvironmentsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listEnvironments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'environments' + ), + lookupEnvironmentHistory: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'environments' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const createEnvironmentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.Environment' + ) as gax.protobuf.Type; + const createEnvironmentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const updateEnvironmentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.Environment' + ) as gax.protobuf.Type; + const updateEnvironmentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createEnvironment: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createEnvironmentResponse.decode.bind(createEnvironmentResponse), + createEnvironmentMetadata.decode.bind(createEnvironmentMetadata) + ), + updateEnvironment: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateEnvironmentResponse.decode.bind(updateEnvironmentResponse), + updateEnvironmentMetadata.decode.bind(updateEnvironmentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Environments', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.environmentsStub) { + return this.environmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Environments. + this.environmentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Environments' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Environments, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const environmentsStubMethods = [ + 'listEnvironments', + 'getEnvironment', + 'createEnvironment', + 'updateEnvironment', + 'deleteEnvironment', + 'lookupEnvironmentHistory', + ]; + for (const methodName of environmentsStubMethods) { + const callPromise = this.environmentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.environmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest + | undefined + ), + {} | undefined + ] + >; + getEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment}. + * 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. + * The first element of the array is an object representing [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getEnvironment(request); + */ + getEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetEnvironmentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getEnvironment(request, options, callback); + } + deleteEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest + | undefined + ), + {} | undefined + ] + >; + deleteEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment} to delete. + * 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. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteEnvironment(request); + */ + deleteEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteEnvironmentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteEnvironment(request, options, callback); + } + + createEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates an {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment} in the specified {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agent}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agent} to create an {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment} for. + * Format: `projects//locations//agents/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Environment} request.environment + * Required. The environment to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example + * const [operation] = await client.createEnvironment(request); + * const [response] = await operation.promise(); + */ + createEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + 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.createEnvironment(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createEnvironment()`. + * @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 checkCreateEnvironmentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateEnvironmentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.Environment, + 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.createEnvironment, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.Environment, + protos.google.protobuf.Struct + >; + } + updateEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Environment} request.environment + * Required. The environment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * 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.updateEnvironment(request); + * const [response] = await operation.promise(); + */ + updateEnvironment( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + 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({ + 'environment.name': request.environment!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateEnvironment()`. + * @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 checkUpdateEnvironmentProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkUpdateEnvironmentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.Environment, + 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.updateEnvironment, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.Environment, + protos.google.protobuf.Struct + >; + } + listEnvironments( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[], + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse + ] + >; + listEnvironments( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + > + ): void; + listEnvironments( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + > + ): void; + /** + * Returns the list of all environments in the specified {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agent}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agent} to list all environments for. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEnvironmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEnvironments( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[], + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listEnvironments(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agent} to list all environments for. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEnvironmentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEnvironmentsStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEnvironments`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Agent|Agent} to list all environments for. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listEnvironmentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listEnvironmentsAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListEnvironmentsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + lookupEnvironmentHistory( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[], + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse + ] + >; + lookupEnvironmentHistory( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + > + ): void; + lookupEnvironmentHistory( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + > + ): void; + /** + * Looks up the history of the specified {@link google.cloud.dialogflow.cx.v3beta1.Environment|Environment}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `lookupEnvironmentHistoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + lookupEnvironmentHistory( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[], + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.lookupEnvironmentHistory( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `lookupEnvironmentHistoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + lookupEnvironmentHistoryStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.lookupEnvironmentHistory.createStream( + this.innerApiCalls.lookupEnvironmentHistory as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `lookupEnvironmentHistory`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Environment]{@link google.cloud.dialogflow.cx.v3beta1.Environment}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.lookupEnvironmentHistoryAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + lookupEnvironmentHistoryAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.ILookupEnvironmentHistoryRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.lookupEnvironmentHistory.asyncIterate( + this.innerApiCalls['lookupEnvironmentHistory'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.environmentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/environments_client_config.json b/src/v3beta1/environments_client_config.json new file mode 100644 index 00000000..df0e636e --- /dev/null +++ b/src/v3beta1/environments_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Environments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListEnvironments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "LookupEnvironmentHistory": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/environments_proto_list.json b/src/v3beta1/environments_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/environments_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/flows_client.ts b/src/v3beta1/flows_client.ts new file mode 100644 index 00000000..bc076e89 --- /dev/null +++ b/src/v3beta1/flows_client.ts @@ -0,0 +1,2135 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/flows_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './flows_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flows}. + * @class + * @memberof v3beta1 + */ +export class FlowsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + flowsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FlowsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof FlowsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listFlows: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'flows' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const trainFlowResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const trainFlowMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + trainFlow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + trainFlowResponse.decode.bind(trainFlowResponse), + trainFlowMetadata.decode.bind(trainFlowMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Flows', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.flowsStub) { + return this.flowsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Flows. + this.flowsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Flows' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Flows, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const flowsStubMethods = [ + 'createFlow', + 'deleteFlow', + 'listFlows', + 'getFlow', + 'updateFlow', + 'trainFlow', + ]; + for (const methodName of flowsStubMethods) { + const callPromise = this.flowsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.flowsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest | undefined, + {} | undefined + ] + >; + createFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a flow in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a flow for. + * Format: `projects//locations//agents/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Flow} request.flow + * Required. The flow to create. + * @param {string} request.languageCode + * The language of the following fields in `flow`: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Flow]{@link google.cloud.dialogflow.cx.v3beta1.Flow}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createFlow(request); + */ + createFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateFlowRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.createFlow(request, options, callback); + } + deleteFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest | undefined, + {} | undefined + ] + >; + deleteFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the flow to delete. + * Format: `projects//locations//agents//flows/`. + * @param {boolean} request.force + * This field has no effect for flows with no incoming transitions. + * For flows with incoming transitions: + * + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the flow, as well as + * any transitions to the flow (i.e. [Target + * flow][EventHandler.target_flow] in event handlers or [Target + * flow][TransitionRoute.target_flow] in transition routes that point to + * this flow will be cleared). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteFlow(request); + */ + deleteFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.cx.v3beta1.IDeleteFlowRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.deleteFlow(request, options, callback); + } + getFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest | undefined, + {} | undefined + ] + >; + getFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the flow to get. + * Format: `projects//locations//agents//flows/`. + * @param {string} request.languageCode + * The language to retrieve the flow for. The following fields are language + * dependent: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Flow]{@link google.cloud.dialogflow.cx.v3beta1.Flow}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getFlow(request); + */ + getFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + protos.google.cloud.dialogflow.cx.v3beta1.IGetFlowRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.getFlow(request, options, callback); + } + updateFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest | undefined, + {} | undefined + ] + >; + updateFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Flow} request.flow + * Required. The flow to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. If `update_mask` is not + * specified, an error will be returned. + * @param {string} request.languageCode + * The language of the following fields in `flow`: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Flow]{@link google.cloud.dialogflow.cx.v3beta1.Flow}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateFlow(request); + */ + updateFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow, + protos.google.cloud.dialogflow.cx.v3beta1.IUpdateFlowRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'flow.name': request.flow!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFlow(request, options, callback); + } + + trainFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + trainFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Trains the specified flow. Note that only the flow in 'draft' environment + * is trained. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The flow to train. + * Format: `projects//locations//agents//flows/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.trainFlow(request); + * const [response] = await operation.promise(); + */ + trainFlow( + request: protos.google.cloud.dialogflow.cx.v3beta1.ITrainFlowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + 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.trainFlow(request, options, callback); + } + /** + * Check the status of the long running operation returned by `trainFlow()`. + * @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 checkTrainFlowProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkTrainFlowProgress( + name: string + ): Promise< + LROperation + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.trainFlow, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + listFlows( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow[], + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse + ] + >; + listFlows( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IFlow + > + ): void; + listFlows( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IFlow + > + ): void; + /** + * Returns the list of all flows in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.languageCode + * The language to list flows for. The following fields are language + * dependent: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Flow]{@link google.cloud.dialogflow.cx.v3beta1.Flow}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFlowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFlows( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IFlow + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IFlow + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFlow[], + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.listFlows(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.languageCode + * The language to list flows for. The following fields are language + * dependent: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Flow]{@link google.cloud.dialogflow.cx.v3beta1.Flow} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFlowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listFlowsStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listFlows.createStream( + this.innerApiCalls.listFlows as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listFlows`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.languageCode + * The language to list flows for. The following fields are language + * dependent: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Flow]{@link google.cloud.dialogflow.cx.v3beta1.Flow}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listFlowsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listFlowsAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListFlowsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listFlows.asyncIterate( + this.innerApiCalls['listFlows'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.flowsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/flows_client_config.json b/src/v3beta1/flows_client_config.json new file mode 100644 index 00000000..3e7e8d33 --- /dev/null +++ b/src/v3beta1/flows_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Flows": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListFlows": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "TrainFlow": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/flows_proto_list.json b/src/v3beta1/flows_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/flows_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/index.ts b/src/v3beta1/index.ts new file mode 100644 index 00000000..c89332f2 --- /dev/null +++ b/src/v3beta1/index.ts @@ -0,0 +1,29 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {AgentsClient} from './agents_client'; +export {EntityTypesClient} from './entity_types_client'; +export {EnvironmentsClient} from './environments_client'; +export {FlowsClient} from './flows_client'; +export {IntentsClient} from './intents_client'; +export {PagesClient} from './pages_client'; +export {SessionEntityTypesClient} from './session_entity_types_client'; +export {SessionsClient} from './sessions_client'; +export {TransitionRouteGroupsClient} from './transition_route_groups_client'; +export {VersionsClient} from './versions_client'; +export {WebhooksClient} from './webhooks_client'; diff --git a/src/v3beta1/intents_client.ts b/src/v3beta1/intents_client.ts new file mode 100644 index 00000000..aa140d59 --- /dev/null +++ b/src/v3beta1/intents_client.ts @@ -0,0 +1,1963 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/intents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './intents_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Intent|Intents}. + * @class + * @memberof v3beta1 + */ +export class IntentsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + intentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IntentsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof IntentsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listIntents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'intents' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Intents', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.intentsStub) { + return this.intentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Intents. + this.intentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Intents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Intents, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const intentsStubMethods = [ + 'listIntents', + 'getIntent', + 'createIntent', + 'updateIntent', + 'deleteIntent', + ]; + for (const methodName of intentsStubMethods) { + const callPromise = this.intentsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.intentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest | undefined, + {} | undefined + ] + >; + getIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent. + * Format: `projects//locations//agents//intents/`. + * @param {string} request.languageCode + * The language to retrieve the intent for. The following fields are language + * dependent: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.cx.v3beta1.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getIntent(request); + */ + getIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + protos.google.cloud.dialogflow.cx.v3beta1.IGetIntentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getIntent(request, options, callback); + } + createIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest + | undefined + ), + {} | undefined + ] + >; + createIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates an intent in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create an intent for. + * Format: `projects//locations//agents/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Intent} request.intent + * Required. The intent to create. + * @param {string} request.languageCode + * The language of the following fields in `intent`: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.cx.v3beta1.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createIntent(request); + */ + createIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateIntentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createIntent(request, options, callback); + } + updateIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest + | undefined + ), + {} | undefined + ] + >; + updateIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Intent} request.intent + * Required. The intent to update. + * @param {string} request.languageCode + * The language of the following fields in `intent`: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {google.protobuf.FieldMask} request.updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Intent]{@link google.cloud.dialogflow.cx.v3beta1.Intent}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateIntent(request); + */ + updateIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateIntentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'intent.name': request.intent!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } + deleteIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest + | undefined + ), + {} | undefined + ] + >; + deleteIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent to delete. + * Format: `projects//locations//agents//intents/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteIntent(request); + */ + deleteIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteIntentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteIntent(request, options, callback); + } + + listIntents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent[], + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse + ] + >; + listIntents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IIntent + > + ): void; + listIntents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IIntent + > + ): void; + /** + * Returns the list of all intents in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * @param {string} request.languageCode + * The language to list intents for. The following fields are language + * dependent: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {google.cloud.dialogflow.cx.v3beta1.IntentView} request.intentView + * The resource view to apply to the returned intent. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Intent]{@link google.cloud.dialogflow.cx.v3beta1.Intent}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listIntentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listIntents( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IIntent + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IIntent + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IIntent[], + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listIntents(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * @param {string} request.languageCode + * The language to list intents for. The following fields are language + * dependent: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {google.cloud.dialogflow.cx.v3beta1.IntentView} request.intentView + * The resource view to apply to the returned intent. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Intent]{@link google.cloud.dialogflow.cx.v3beta1.Intent} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listIntentsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listIntentsStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listIntents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * @param {string} request.languageCode + * The language to list intents for. The following fields are language + * dependent: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {google.cloud.dialogflow.cx.v3beta1.IntentView} request.intentView + * The resource view to apply to the returned intent. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Intent]{@link google.cloud.dialogflow.cx.v3beta1.Intent}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listIntentsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listIntentsAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListIntentsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.intentsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/intents_client_config.json b/src/v3beta1/intents_client_config.json new file mode 100644 index 00000000..dd60bb05 --- /dev/null +++ b/src/v3beta1/intents_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Intents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/intents_proto_list.json b/src/v3beta1/intents_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/intents_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/pages_client.ts b/src/v3beta1/pages_client.ts new file mode 100644 index 00000000..48d838eb --- /dev/null +++ b/src/v3beta1/pages_client.ts @@ -0,0 +1,1984 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/pages_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './pages_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Page|Pages}. + * @class + * @memberof v3beta1 + */ +export class PagesClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + pagesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of PagesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof PagesClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listPages: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'pages' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Pages', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.pagesStub) { + return this.pagesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Pages. + this.pagesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Pages' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Pages, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const pagesStubMethods = [ + 'listPages', + 'getPage', + 'createPage', + 'updatePage', + 'deletePage', + ]; + for (const methodName of pagesStubMethods) { + const callPromise = this.pagesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.pagesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest | undefined, + {} | undefined + ] + >; + getPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified page. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the page. + * Format: `projects//locations//agents//flows//pages/`. + * @param {string} request.languageCode + * The language to retrieve the page for. The following fields are language + * dependent: + * + * * `Page.entry_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * + * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Page]{@link google.cloud.dialogflow.cx.v3beta1.Page}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getPage(request); + */ + getPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + protos.google.cloud.dialogflow.cx.v3beta1.IGetPageRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.getPage(request, options, callback); + } + createPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest | undefined, + {} | undefined + ] + >; + createPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a page in the specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to create a page for. + * Format: `projects//locations//agents//flows/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Page} request.page + * Required. The page to create. + * @param {string} request.languageCode + * The language of the following fields in `page`: + * + * * `Page.entry_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * + * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Page]{@link google.cloud.dialogflow.cx.v3beta1.Page}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createPage(request); + */ + createPage( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + protos.google.cloud.dialogflow.cx.v3beta1.ICreatePageRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.createPage(request, options, callback); + } + updatePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest | undefined, + {} | undefined + ] + >; + updatePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updatePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified page. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Page} request.page + * Required. The page to update. + * @param {string} request.languageCode + * The language of the following fields in `page`: + * + * * `Page.entry_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * + * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {google.protobuf.FieldMask} request.updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Page]{@link google.cloud.dialogflow.cx.v3beta1.Page}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updatePage(request); + */ + updatePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage, + protos.google.cloud.dialogflow.cx.v3beta1.IUpdatePageRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'page.name': request.page!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updatePage(request, options, callback); + } + deletePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest | undefined, + {} | undefined + ] + >; + deletePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deletePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified page. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the page to delete. + * Format: `projects//locations//agents//Flows//pages/`. + * @param {boolean} request.force + * This field has no effect for pages with no incoming transitions. + * For pages with incoming transitions: + * + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the page, as well as + * any transitions to the page (i.e. [Target + * page][EventHandler.target_page] in event handlers or [Target + * page][TransitionRoute.target_page] in transition routes that point to + * this page will be cleared). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deletePage(request); + */ + deletePage( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.cx.v3beta1.IDeletePageRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.deletePage(request, options, callback); + } + + listPages( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage[], + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesResponse + ] + >; + listPages( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListPagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IPage + > + ): void; + listPages( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListPagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IPage + > + ): void; + /** + * Returns the list of all pages in the specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * @param {string} request.languageCode + * The language to list pages for. The following fields are language + * dependent: + * + * * `Page.entry_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * + * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Page]{@link google.cloud.dialogflow.cx.v3beta1.Page}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listPagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listPages( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListPagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IPage + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListPagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IPage + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IPage[], + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListPagesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.listPages(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * @param {string} request.languageCode + * The language to list pages for. The following fields are language + * dependent: + * + * * `Page.entry_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * + * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Page]{@link google.cloud.dialogflow.cx.v3beta1.Page} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listPagesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listPagesStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listPages.createStream( + this.innerApiCalls.listPages as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listPages`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * @param {string} request.languageCode + * The language to list pages for. The following fields are language + * dependent: + * + * * `Page.entry_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * + * `Page.transition_route_groups.transition_routes.trigger_fulfillment.messages` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Page]{@link google.cloud.dialogflow.cx.v3beta1.Page}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listPagesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listPagesAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListPagesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listPages.asyncIterate( + this.innerApiCalls['listPages'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.pagesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/pages_client_config.json b/src/v3beta1/pages_client_config.json new file mode 100644 index 00000000..df562343 --- /dev/null +++ b/src/v3beta1/pages_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Pages": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListPages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetPage": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreatePage": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdatePage": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeletePage": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/pages_proto_list.json b/src/v3beta1/pages_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/pages_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/session_entity_types_client.ts b/src/v3beta1/session_entity_types_client.ts new file mode 100644 index 00000000..aadc0f6c --- /dev/null +++ b/src/v3beta1/session_entity_types_client.ts @@ -0,0 +1,2034 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/session_entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './session_entity_types_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType|SessionEntityTypes}. + * @class + * @memberof v3beta1 + */ +export class SessionEntityTypesClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionEntityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionEntityTypesClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SessionEntityTypesClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listSessionEntityTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sessionEntityTypes' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sessionEntityTypesStub) { + return this.sessionEntityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes. + this.sessionEntityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1 + .SessionEntityTypes, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sessionEntityTypesStubMethods = [ + 'listSessionEntityTypes', + 'getSessionEntityType', + 'createSessionEntityType', + 'updateSessionEntityType', + 'deleteSessionEntityType', + ]; + for (const methodName of sessionEntityTypesStubMethods) { + const callPromise = this.sessionEntityTypesStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionEntityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + getSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified session entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getSessionEntityType(request); + */ + getSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSessionEntityType(request, options, callback); + } + createSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + createSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a session entity type. + * + * If the specified session entity type already exists, overrides the + * session entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a session entity type for. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} request.sessionEntityType + * Required. The session entity type to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createSessionEntityType(request); + */ + createSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createSessionEntityType( + request, + options, + callback + ); + } + updateSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified session entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.SessionEntityType} request.sessionEntityType + * Required. The session entity type to update. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {google.protobuf.FieldMask} request.updateMask + * The mask to control which fields get updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SessionEntityType]{@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateSessionEntityType(request); + */ + updateSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'session_entity_type.name': request.sessionEntityType!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType( + request, + options, + callback + ); + } + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified session entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the session entity type to delete. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteSessionEntityType(request); + */ + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSessionEntityType( + request, + options, + callback + ); + } + + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[], + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse + ] + >; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType + > + ): void; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType + > + ): void; + /** + * Returns the list of all session entity types in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [SessionEntityType]{@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSessionEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[], + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSessionEntityTypes( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SessionEntityType]{@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSessionEntityTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSessionEntityTypesStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listSessionEntityTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SessionEntityType]{@link google.cloud.dialogflow.cx.v3beta1.SessionEntityType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listSessionEntityTypesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listSessionEntityTypesAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListSessionEntityTypesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath( + project: string, + location: string, + agent: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + agent: agent, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.sessionEntityTypesStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/session_entity_types_client_config.json b/src/v3beta1/session_entity_types_client_config.json new file mode 100644 index 00000000..a11a7c83 --- /dev/null +++ b/src/v3beta1/session_entity_types_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListSessionEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/session_entity_types_proto_list.json b/src/v3beta1/session_entity_types_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/session_entity_types_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/sessions_client.ts b/src/v3beta1/sessions_client.ts new file mode 100644 index 00000000..3c2e62b9 --- /dev/null +++ b/src/v3beta1/sessions_client.ts @@ -0,0 +1,1770 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import * as path from 'path'; + +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/sessions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sessions_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A 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. + * @class + * @memberof v3beta1 + */ +export class SessionsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SessionsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectLocationAgentEnvironmentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingDetectIntent: new this._gaxModule.StreamDescriptor( + gax.StreamType.BIDI_STREAMING + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Sessions', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sessionsStub) { + return this.sessionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Sessions. + this.sessionsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Sessions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Sessions, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sessionsStubMethods = [ + 'detectIntent', + 'streamingDetectIntent', + 'matchIntent', + 'fulfillIntent', + ]; + for (const methodName of sessionsStubMethods) { + const callPromise = this.sessionsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.stream[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + detectIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest + | undefined + ), + {} | undefined + ] + >; + detectIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Processes a natural language query and returns structured, actionable data + * as a result. This method is not idempotent, because it may cause session + * entity types to be updated, which in turn might affect results of future + * queries. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.session + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * @param {google.cloud.dialogflow.cx.v3beta1.QueryParameters} request.queryParams + * The parameters of this query. + * @param {google.cloud.dialogflow.cx.v3beta1.QueryInput} request.queryInput + * Required. The input specification. + * @param {google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig} request.outputAudioConfig + * Instructs the speech synthesizer how to generate the output audio. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DetectIntentResponse]{@link google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.detectIntent(request); + */ + detectIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + session: request.session || '', + }); + this.initialize(); + return this.innerApiCalls.detectIntent(request, options, callback); + } + matchIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest | undefined, + {} | undefined + ] + >; + matchIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + matchIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Returns preliminary intent match results, doesn't change the session + * status. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.session + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * @param {google.cloud.dialogflow.cx.v3beta1.QueryParameters} request.queryParams + * The parameters of this query. + * @param {google.cloud.dialogflow.cx.v3beta1.QueryInput} request.queryInput + * Required. The input specification. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MatchIntentResponse]{@link google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.matchIntent(request); + */ + matchIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse, + protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + session: request.session || '', + }); + this.initialize(); + return this.innerApiCalls.matchIntent(request, options, callback); + } + fulfillIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest + | undefined + ), + {} | undefined + ] + >; + fulfillIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + fulfillIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest + | null + | undefined, + {} | null | undefined + > + ): 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest} request.matchIntentRequest + * Must be same as the corresponding MatchIntent request, otherwise the + * behavior is undefined. + * @param {google.cloud.dialogflow.cx.v3beta1.Match} request.match + * The matched intent/event to fulfill. + * @param {google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig} request.outputAudioConfig + * Instructs the speech synthesizer how to generate output audio. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [FulfillIntentResponse]{@link google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.fulfillIntent(request); + */ + fulfillIntent( + request: protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, + | protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'match_intent_request.session': request.matchIntentRequest!.session || '', + }); + this.initialize(); + return this.innerApiCalls.fulfillIntent(request, options, callback); + } + + /** + * Processes a natural language query in audio format in a streaming fashion + * and returns structured, actionable data as a result. This method is only + * available via the gRPC API (not REST). + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest} for write() method, and + * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example + * const stream = client.streamingDetectIntent(); + * stream.on('data', (response) => { ... }); + * stream.on('end', () => { ... }); + * stream.write(request); + * stream.end(); + */ + streamingDetectIntent(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionPath( + project: string, + location: string, + agent: string, + environment: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath( + project: string, + location: string, + agent: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + agent: agent, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.sessionsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/sessions_client_config.json b/src/v3beta1/sessions_client_config.json new file mode 100644 index 00000000..8650fba2 --- /dev/null +++ b/src/v3beta1/sessions_client_config.json @@ -0,0 +1,49 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Sessions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "DetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingDetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "MatchIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "FulfillIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/sessions_proto_list.json b/src/v3beta1/sessions_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/sessions_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/transition_route_groups_client.ts b/src/v3beta1/transition_route_groups_client.ts new file mode 100644 index 00000000..a99d8708 --- /dev/null +++ b/src/v3beta1/transition_route_groups_client.ts @@ -0,0 +1,1992 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/transition_route_groups_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './transition_route_groups_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroups}. + * @class + * @memberof v3beta1 + */ +export class TransitionRouteGroupsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + transitionRouteGroupsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TransitionRouteGroupsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof TransitionRouteGroupsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listTransitionRouteGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'transitionRouteGroups' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.transitionRouteGroupsStub) { + return this.transitionRouteGroupsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups. + this.transitionRouteGroupsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1 + .TransitionRouteGroups, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const transitionRouteGroupsStubMethods = [ + 'listTransitionRouteGroups', + 'getTransitionRouteGroup', + 'createTransitionRouteGroup', + 'updateTransitionRouteGroup', + 'deleteTransitionRouteGroup', + ]; + for (const methodName of transitionRouteGroupsStubMethods) { + const callPromise = this.transitionRouteGroupsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.transitionRouteGroupsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + >; + getTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup}. + * 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. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TransitionRouteGroup]{@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getTransitionRouteGroup(request); + */ + getTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IGetTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.getTransitionRouteGroup( + request, + options, + callback + ); + } + createTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + >; + createTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates an {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup} in the specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to create an {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup} for. + * Format: `projects//locations//agents//flows/`. + * @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. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TransitionRouteGroup]{@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createTransitionRouteGroup(request); + */ + createTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.createTransitionRouteGroup( + request, + options, + callback + ); + } + updateTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + >; + updateTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} request.transitionRouteGroup + * Required. The transition route group to update. + * @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. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TransitionRouteGroup]{@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateTransitionRouteGroup(request); + */ + updateTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'transition_route_group.name': request.transitionRouteGroup!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateTransitionRouteGroup( + request, + options, + callback + ); + } + deleteTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + >; + deleteTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the {@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup|TransitionRouteGroup} to delete. + * Format: `projects//locations//agents//flows//transitionRouteGroups/`. + * @param {boolean} request.force + * This field has no effect for transition route group that no page is using. + * If the transition route group is referenced by any page: + * + * * If `force` is set to false, an error will be returned with message + * indicating pages that reference the transition route group. + * * If `force` is set to true, Dialogflow will remove the transition route + * group, as well as any reference to it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteTransitionRouteGroup(request); + */ + deleteTransitionRouteGroup( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteTransitionRouteGroupRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.deleteTransitionRouteGroup( + request, + options, + callback + ); + } + + listTransitionRouteGroups( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[], + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse + ] + >; + listTransitionRouteGroups( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup + > + ): void; + listTransitionRouteGroups( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup + > + ): void; + /** + * Returns the list of all transition route groups in the specified flow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {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. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [TransitionRouteGroup]{@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTransitionRouteGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTransitionRouteGroups( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[], + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.listTransitionRouteGroups( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {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. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [TransitionRouteGroup]{@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTransitionRouteGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTransitionRouteGroupsStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTransitionRouteGroups.createStream( + this.innerApiCalls.listTransitionRouteGroups as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listTransitionRouteGroups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {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. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [TransitionRouteGroup]{@link google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listTransitionRouteGroupsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listTransitionRouteGroupsAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListTransitionRouteGroupsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTransitionRouteGroups.asyncIterate( + this.innerApiCalls['listTransitionRouteGroups'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.transitionRouteGroupsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/transition_route_groups_client_config.json b/src/v3beta1/transition_route_groups_client_config.json new file mode 100644 index 00000000..a1f47451 --- /dev/null +++ b/src/v3beta1/transition_route_groups_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListTransitionRouteGroups": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetTransitionRouteGroup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateTransitionRouteGroup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateTransitionRouteGroup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteTransitionRouteGroup": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/transition_route_groups_proto_list.json b/src/v3beta1/transition_route_groups_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/transition_route_groups_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/versions_client.ts b/src/v3beta1/versions_client.ts new file mode 100644 index 00000000..2f2e2785 --- /dev/null +++ b/src/v3beta1/versions_client.ts @@ -0,0 +1,2135 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/versions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './versions_client_config.json'; +import {operationsProtos} from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Version|Versions}. + * @class + * @memberof v3beta1 + */ +export class VersionsClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + versionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VersionsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof VersionsClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'versions' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? this._gaxModule.protobuf.Root.fromJSON( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + ) + : this._gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = this._gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const createVersionResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.Version' + ) as gax.protobuf.Type; + const createVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata' + ) as gax.protobuf.Type; + const loadVersionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const loadVersionMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createVersionResponse.decode.bind(createVersionResponse), + createVersionMetadata.decode.bind(createVersionMetadata) + ), + loadVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + loadVersionResponse.decode.bind(loadVersionResponse), + loadVersionMetadata.decode.bind(loadVersionMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Versions', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.versionsStub) { + return this.versionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Versions. + this.versionsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Versions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Versions, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const versionsStubMethods = [ + 'listVersions', + 'getVersion', + 'createVersion', + 'updateVersion', + 'deleteVersion', + 'loadVersion', + ]; + for (const methodName of versionsStubMethods) { + const callPromise = this.versionsStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.versionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest | undefined, + {} | undefined + ] + >; + getVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified {@link google.cloud.dialogflow.cx.v3beta1.Version|Version}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the {@link google.cloud.dialogflow.cx.v3beta1.Version|Version}. + * Format: `projects//locations//agents//flows//versions/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.cx.v3beta1.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getVersion(request); + */ + getVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.IGetVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getVersion(request, options, callback); + } + updateVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest + | undefined + ), + {} | undefined + ] + >; + updateVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified {@link google.cloud.dialogflow.cx.v3beta1.Version|Version}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Version} request.version + * Required. The version to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. Currently only `description` + * and `display_name` can be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Version]{@link google.cloud.dialogflow.cx.v3beta1.Version}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateVersion(request); + */ + updateVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateVersionRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'version.name': request.version!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } + deleteVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest + | undefined + ), + {} | undefined + ] + >; + deleteVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified {@link google.cloud.dialogflow.cx.v3beta1.Version|Version}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the {@link google.cloud.dialogflow.cx.v3beta1.Version|Version} to delete. + * Format: `projects//locations//agents//flows//versions/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteVersion(request); + */ + deleteVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteVersionRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteVersion(request, options, callback); + } + + createVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a {@link google.cloud.dialogflow.cx.v3beta1.Version|Version} in the specified {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flow}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flow} to create an {@link google.cloud.dialogflow.cx.v3beta1.Version|Version} for. + * Format: `projects//locations//agents//flows/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Version} request.version + * Required. The version to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * 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.createVersion(request); + * const [response] = await operation.promise(); + */ + createVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >, + 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.createVersion(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createVersion()`. + * @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 checkCreateVersionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkCreateVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.Version, + protos.google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.createVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.Version, + protos.google.cloud.dialogflow.cx.v3beta1.CreateVersionOperationMetadata + >; + } + loadVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + loadVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + loadVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + /** + * Loads a specified version to draft version. + * + * @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. + * 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). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.loadVersion(request); + * const [response] = await operation.promise(); + */ + loadVersion( + request: protos.google.cloud.dialogflow.cx.v3beta1.ILoadVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + 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.loadVersion(request, options, callback); + } + /** + * Check the status of the long running operation returned by `loadVersion()`. + * @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 checkLoadVersionProgress(name); + * console.log(decodedOperation.result); + * console.log(decodedOperation.done); + * console.log(decodedOperation.metadata); + */ + async checkLoadVersionProgress( + name: string + ): Promise< + LROperation + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.loadVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + listVersions( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IVersion[], + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse + ] + >; + listVersions( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IVersion + > + ): void; + listVersions( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IVersion + > + ): void; + /** + * Returns the list of all versions in the specified {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flow}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flow} to list all versions for. + * Format: `projects//locations//agents//flows/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Version]{@link google.cloud.dialogflow.cx.v3beta1.Version}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listVersions( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IVersion + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IVersion + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IVersion[], + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listVersions(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flow} to list all versions for. + * Format: `projects//locations//agents//flows/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Version]{@link google.cloud.dialogflow.cx.v3beta1.Version} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listVersionsStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.dialogflow.cx.v3beta1.Flow|Flow} to list all versions for. + * Format: `projects//locations//agents//flows/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Version]{@link google.cloud.dialogflow.cx.v3beta1.Version}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listVersionsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listVersionsAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListVersionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.versionsStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/versions_client_config.json b/src/v3beta1/versions_client_config.json new file mode 100644 index 00000000..0c152904 --- /dev/null +++ b/src/v3beta1/versions_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Versions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "LoadVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/versions_proto_list.json b/src/v3beta1/versions_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/versions_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/src/v3beta1/webhooks_client.ts b/src/v3beta1/webhooks_client.ts new file mode 100644 index 00000000..beabc7ec --- /dev/null +++ b/src/v3beta1/webhooks_client.ts @@ -0,0 +1,2095 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3beta1/webhooks_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './webhooks_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.cx.v3beta1.Webhook|Webhooks}. + * @class + * @memberof v3beta1 + */ +export class WebhooksClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + webhooksStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebhooksClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WebhooksClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + agentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}' + ), + entityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}' + ), + environmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}' + ), + flowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}' + ), + intentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + pagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationAgentEnvironmentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}' + ), + projectLocationAgentEnvironmentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}' + ), + projectLocationAgentSessionEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}' + ), + transitionRouteGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}' + ), + versionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}' + ), + webhookPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listWebhooks: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'webhooks' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.cx.v3beta1.Webhooks', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.webhooksStub) { + return this.webhooksStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.cx.v3beta1.Webhooks. + this.webhooksStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.cx.v3beta1.Webhooks' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.cx.v3beta1.Webhooks, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const webhooksStubMethods = [ + 'listWebhooks', + 'getWebhook', + 'createWebhook', + 'updateWebhook', + 'deleteWebhook', + ]; + for (const methodName of webhooksStubMethods) { + const callPromise = this.webhooksStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.webhooksStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'dialogflow.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest | undefined, + {} | undefined + ] + >; + getWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Retrieves the specified webhook. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the webhook. + * Format: `projects//locations//agents//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. + * The first element of the array is an object representing [Webhook]{@link google.cloud.dialogflow.cx.v3beta1.Webhook}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getWebhook(request); + */ + getWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + protos.google.cloud.dialogflow.cx.v3beta1.IGetWebhookRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.getWebhook(request, options, callback); + } + createWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest + | undefined + ), + {} | undefined + ] + >; + createWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a webhook in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a webhook for. + * Format: `projects//locations//agents/`. + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook} request.webhook + * Required. The webhook to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Webhook]{@link google.cloud.dialogflow.cx.v3beta1.Webhook}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createWebhook(request); + */ + createWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.ICreateWebhookRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.createWebhook(request, options, callback); + } + updateWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest + | undefined + ), + {} | undefined + ] + >; + updateWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates the specified webhook. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.cx.v3beta1.Webhook} request.webhook + * Required. The webhook to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Webhook]{@link google.cloud.dialogflow.cx.v3beta1.Webhook}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateWebhook(request); + */ + updateWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IUpdateWebhookRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'webhook.name': request.webhook!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateWebhook(request, options, callback); + } + deleteWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest + | undefined + ), + {} | undefined + ] + >; + deleteWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes the specified webhook. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the webhook to delete. + * Format: `projects//locations//agents//webhooks/`. + * @param {boolean} request.force + * This field has no effect for webhook not being used. + * For webhooks that are used by pages/flows/transition route groups: + * + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the webhook, as well + * as any references to the webhook (i.e. {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.webhook|Webhook} + * and {@link google.cloud.dialogflow.cx.v3beta1.Fulfillment.tag|tag}in fulfillments that point to this webhook + * will be removed). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteWebhook(request); + */ + deleteWebhook( + request: protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.cx.v3beta1.IDeleteWebhookRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.deleteWebhook(request, options, callback); + } + + listWebhooks( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook[], + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse + ] + >; + listWebhooks( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook + > + ): void; + listWebhooks( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook + > + ): void; + /** + * Returns the list of all webhooks in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Webhook]{@link google.cloud.dialogflow.cx.v3beta1.Webhook}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listWebhooksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listWebhooks( + request: protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + | protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse + | null + | undefined, + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3beta1.IWebhook[], + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest | null, + protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback 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.listWebhooks(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Webhook]{@link google.cloud.dialogflow.cx.v3beta1.Webhook} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listWebhooksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listWebhooksStream( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listWebhooks.createStream( + this.innerApiCalls.listWebhooks as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listWebhooks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Webhook]{@link google.cloud.dialogflow.cx.v3beta1.Webhook}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listWebhooksAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listWebhooksAsync( + request?: protos.google.cloud.dialogflow.cx.v3beta1.IListWebhooksRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listWebhooks.asyncIterate( + this.innerApiCalls['listWebhooks'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified agent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @returns {string} Resource name string. + */ + agentPath(project: string, location: string, agent: string) { + return this.pathTemplates.agentPathTemplate.render({ + project: project, + location: location, + agent: agent, + }); + } + + /** + * Parse the project from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).project; + } + + /** + * Parse the location from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).location; + } + + /** + * Parse the agent from Agent resource. + * + * @param {string} agentName + * A fully-qualified path representing Agent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromAgentName(agentName: string) { + return this.pathTemplates.agentPathTemplate.match(agentName).agent; + } + + /** + * Return a fully-qualified entityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} entity_type + * @returns {string} Resource name string. + */ + entityTypePath( + project: string, + location: string, + agent: string, + entityType: string + ) { + return this.pathTemplates.entityTypePathTemplate.render({ + project: project, + location: location, + agent: agent, + entity_type: entityType, + }); + } + + /** + * Parse the project from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .project; + } + + /** + * Parse the location from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .location; + } + + /** + * Parse the agent from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .agent; + } + + /** + * Parse the entity_type from EntityType resource. + * + * @param {string} entityTypeName + * A fully-qualified path representing EntityType resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromEntityTypeName(entityTypeName: string) { + return this.pathTemplates.entityTypePathTemplate.match(entityTypeName) + .entity_type; + } + + /** + * Return a fully-qualified environment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @returns {string} Resource name string. + */ + environmentPath( + project: string, + location: string, + agent: string, + environment: string + ) { + return this.pathTemplates.environmentPathTemplate.render({ + project: project, + location: location, + agent: agent, + environment: environment, + }); + } + + /** + * Parse the project from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .project; + } + + /** + * Parse the location from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .location; + } + + /** + * Parse the agent from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .agent; + } + + /** + * Parse the environment from Environment resource. + * + * @param {string} environmentName + * A fully-qualified path representing Environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromEnvironmentName(environmentName: string) { + return this.pathTemplates.environmentPathTemplate.match(environmentName) + .environment; + } + + /** + * Return a fully-qualified flow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @returns {string} Resource name string. + */ + flowPath(project: string, location: string, agent: string, flow: string) { + return this.pathTemplates.flowPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + }); + } + + /** + * Parse the project from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).project; + } + + /** + * Parse the location from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).location; + } + + /** + * Parse the agent from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).agent; + } + + /** + * Parse the flow from Flow resource. + * + * @param {string} flowName + * A fully-qualified path representing Flow resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromFlowName(flowName: string) { + return this.pathTemplates.flowPathTemplate.match(flowName).flow; + } + + /** + * Return a fully-qualified intent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} intent + * @returns {string} Resource name string. + */ + intentPath(project: string, location: string, agent: string, intent: string) { + return this.pathTemplates.intentPathTemplate.render({ + project: project, + location: location, + agent: agent, + intent: intent, + }); + } + + /** + * Parse the project from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).project; + } + + /** + * Parse the location from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).location; + } + + /** + * Parse the agent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).agent; + } + + /** + * Parse the intent from Intent resource. + * + * @param {string} intentName + * A fully-qualified path representing Intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromIntentName(intentName: string) { + return this.pathTemplates.intentPathTemplate.match(intentName).intent; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified page resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} page + * @returns {string} Resource name string. + */ + pagePath( + project: string, + location: string, + agent: string, + flow: string, + page: string + ) { + return this.pathTemplates.pagePathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + page: page, + }); + } + + /** + * Parse the project from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).project; + } + + /** + * Parse the location from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).location; + } + + /** + * Parse the agent from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).agent; + } + + /** + * Parse the flow from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).flow; + } + + /** + * Parse the page from Page resource. + * + * @param {string} pageName + * A fully-qualified path representing Page resource. + * @returns {string} A string representing the page. + */ + matchPageFromPageName(pageName: string) { + return this.pathTemplates.pagePathTemplate.match(pageName).page; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionPath( + project: string, + location: string, + agent: string, + environment: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSession resource. + * + * @param {string} projectLocationAgentEnvironmentSessionName + * A fully-qualified path representing project_location_agent_environment_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionName( + projectLocationAgentEnvironmentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match( + projectLocationAgentEnvironmentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} environment + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentSessionEntityTypePath( + project: string, + location: string, + agent: string, + environment: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + environment: environment, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).agent; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).environment; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + projectLocationAgentEnvironmentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath( + project: string, + location: string, + agent: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + agent: agent, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + agent: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + agent: agent, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the agent from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).agent; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified transitionRouteGroup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} transition_route_group + * @returns {string} Resource name string. + */ + transitionRouteGroupPath( + project: string, + location: string, + agent: string, + flow: string, + transitionRouteGroup: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + transition_route_group: transitionRouteGroup, + }); + } + + /** + * Parse the project from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).project; + } + + /** + * Parse the location from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).location; + } + + /** + * Parse the agent from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).agent; + } + + /** + * Parse the flow from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromTransitionRouteGroupName(transitionRouteGroupName: string) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).flow; + } + + /** + * Parse the transition_route_group from TransitionRouteGroup resource. + * + * @param {string} transitionRouteGroupName + * A fully-qualified path representing TransitionRouteGroup resource. + * @returns {string} A string representing the transition_route_group. + */ + matchTransitionRouteGroupFromTransitionRouteGroupName( + transitionRouteGroupName: string + ) { + return this.pathTemplates.transitionRouteGroupPathTemplate.match( + transitionRouteGroupName + ).transition_route_group; + } + + /** + * Return a fully-qualified version resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} flow + * @param {string} version + * @returns {string} Resource name string. + */ + versionPath( + project: string, + location: string, + agent: string, + flow: string, + version: string + ) { + return this.pathTemplates.versionPathTemplate.render({ + project: project, + location: location, + agent: agent, + flow: flow, + version: version, + }); + } + + /** + * Parse the project from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).project; + } + + /** + * Parse the location from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).location; + } + + /** + * Parse the agent from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).agent; + } + + /** + * Parse the flow from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the flow. + */ + matchFlowFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).flow; + } + + /** + * Parse the version from Version resource. + * + * @param {string} versionName + * A fully-qualified path representing Version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromVersionName(versionName: string) { + return this.pathTemplates.versionPathTemplate.match(versionName).version; + } + + /** + * Return a fully-qualified webhook resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} agent + * @param {string} webhook + * @returns {string} Resource name string. + */ + webhookPath( + project: string, + location: string, + agent: string, + webhook: string + ) { + return this.pathTemplates.webhookPathTemplate.render({ + project: project, + location: location, + agent: agent, + webhook: webhook, + }); + } + + /** + * Parse the project from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).project; + } + + /** + * Parse the location from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).location; + } + + /** + * Parse the agent from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the agent. + */ + matchAgentFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).agent; + } + + /** + * Parse the webhook from Webhook resource. + * + * @param {string} webhookName + * A fully-qualified path representing Webhook resource. + * @returns {string} A string representing the webhook. + */ + matchWebhookFromWebhookName(webhookName: string) { + return this.pathTemplates.webhookPathTemplate.match(webhookName).webhook; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.webhooksStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/src/v3beta1/webhooks_client_config.json b/src/v3beta1/webhooks_client_config.json new file mode 100644 index 00000000..7968ee27 --- /dev/null +++ b/src/v3beta1/webhooks_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3beta1.Webhooks": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListWebhooks": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetWebhook": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateWebhook": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateWebhook": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteWebhook": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/src/v3beta1/webhooks_proto_list.json b/src/v3beta1/webhooks_proto_list.json new file mode 100644 index 00000000..c39c02a6 --- /dev/null +++ b/src/v3beta1/webhooks_proto_list.json @@ -0,0 +1,16 @@ +[ + "../../protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "../../protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto" +] diff --git a/synth.metadata b/synth.metadata index 74f15a63..5806cac9 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,27 +3,29 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-dialogflow-cx.git", - "sha": "9dc083e6580420313ead0baa95a5bd57aaec905c" + "remote": "git@github.com:googleapis/nodejs-dialogflow-cx.git", + "sha": "9a5d9538d8d9435cdd0b8b21a64d8fd95cda8218" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "7ea91db77f53f169a08726bd33efb73042c38284", - "internalRef": "343321102" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" + "sha": "ebdbe9ab534486cf900700add1e129dff780b481", + "internalRef": "344172074" } } ], "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "dialogflow", + "apiVersion": "v3beta1", + "language": "nodejs", + "generator": "bazel" + } + }, { "client": { "source": "googleapis", @@ -33,5 +35,193 @@ "generator": "bazel" } } + ], + "generatedFiles": [ + ".eslintignore", + ".eslintrc.json", + ".gitattributes", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/release-please.yml", + ".github/workflows/ci.yaml", + ".gitignore", + ".jsdoc.js", + ".kokoro/.gitattributes", + ".kokoro/common.cfg", + ".kokoro/continuous/node10/common.cfg", + ".kokoro/continuous/node10/docs.cfg", + ".kokoro/continuous/node10/test.cfg", + ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/lint.cfg", + ".kokoro/continuous/node12/samples-test.cfg", + ".kokoro/continuous/node12/system-test.cfg", + ".kokoro/continuous/node12/test.cfg", + ".kokoro/docs.sh", + ".kokoro/lint.sh", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/node10/common.cfg", + ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/samples-test.cfg", + ".kokoro/presubmit/node12/system-test.cfg", + ".kokoro/presubmit/node12/test.cfg", + ".kokoro/publish.sh", + ".kokoro/release/docs-devsite.cfg", + ".kokoro/release/docs-devsite.sh", + ".kokoro/release/docs.cfg", + ".kokoro/release/docs.sh", + ".kokoro/release/publish.cfg", + ".kokoro/samples-test.sh", + ".kokoro/system-test.sh", + ".kokoro/test.bat", + ".kokoro/test.sh", + ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", + ".mocharc.js", + ".nycrc", + ".prettierignore", + ".prettierrc.js", + ".trampolinerc", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "README.md", + "api-extractor.json", + "linkinator.config.json", + "protos/google/cloud/dialogflow/cx/v3/agent.proto", + "protos/google/cloud/dialogflow/cx/v3/audio_config.proto", + "protos/google/cloud/dialogflow/cx/v3/entity_type.proto", + "protos/google/cloud/dialogflow/cx/v3/environment.proto", + "protos/google/cloud/dialogflow/cx/v3/flow.proto", + "protos/google/cloud/dialogflow/cx/v3/fulfillment.proto", + "protos/google/cloud/dialogflow/cx/v3/intent.proto", + "protos/google/cloud/dialogflow/cx/v3/page.proto", + "protos/google/cloud/dialogflow/cx/v3/response_message.proto", + "protos/google/cloud/dialogflow/cx/v3/security_settings.proto", + "protos/google/cloud/dialogflow/cx/v3/session.proto", + "protos/google/cloud/dialogflow/cx/v3/session_entity_type.proto", + "protos/google/cloud/dialogflow/cx/v3/transition_route_group.proto", + "protos/google/cloud/dialogflow/cx/v3/version.proto", + "protos/google/cloud/dialogflow/cx/v3/webhook.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/agent.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/audio_config.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/entity_type.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/environment.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/flow.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/fulfillment.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/intent.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/page.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/response_message.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/session.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/session_entity_type.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/transition_route_group.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/version.proto", + "protos/google/cloud/dialogflow/cx/v3beta1/webhook.proto", + "protos/protos.d.ts", + "protos/protos.js", + "protos/protos.json", + "renovate.json", + "samples/README.md", + "src/index.ts", + "src/v3/agents_client.ts", + "src/v3/agents_client_config.json", + "src/v3/agents_proto_list.json", + "src/v3/entity_types_client.ts", + "src/v3/entity_types_client_config.json", + "src/v3/entity_types_proto_list.json", + "src/v3/environments_client.ts", + "src/v3/environments_client_config.json", + "src/v3/environments_proto_list.json", + "src/v3/flows_client.ts", + "src/v3/flows_client_config.json", + "src/v3/flows_proto_list.json", + "src/v3/index.ts", + "src/v3/intents_client.ts", + "src/v3/intents_client_config.json", + "src/v3/intents_proto_list.json", + "src/v3/pages_client.ts", + "src/v3/pages_client_config.json", + "src/v3/pages_proto_list.json", + "src/v3/security_settings_service_client.ts", + "src/v3/security_settings_service_client_config.json", + "src/v3/security_settings_service_proto_list.json", + "src/v3/session_entity_types_client.ts", + "src/v3/session_entity_types_client_config.json", + "src/v3/session_entity_types_proto_list.json", + "src/v3/sessions_client.ts", + "src/v3/sessions_client_config.json", + "src/v3/sessions_proto_list.json", + "src/v3/transition_route_groups_client.ts", + "src/v3/transition_route_groups_client_config.json", + "src/v3/transition_route_groups_proto_list.json", + "src/v3/versions_client.ts", + "src/v3/versions_client_config.json", + "src/v3/versions_proto_list.json", + "src/v3/webhooks_client.ts", + "src/v3/webhooks_client_config.json", + "src/v3/webhooks_proto_list.json", + "src/v3beta1/agents_client.ts", + "src/v3beta1/agents_client_config.json", + "src/v3beta1/agents_proto_list.json", + "src/v3beta1/entity_types_client.ts", + "src/v3beta1/entity_types_client_config.json", + "src/v3beta1/entity_types_proto_list.json", + "src/v3beta1/environments_client.ts", + "src/v3beta1/environments_client_config.json", + "src/v3beta1/environments_proto_list.json", + "src/v3beta1/flows_client.ts", + "src/v3beta1/flows_client_config.json", + "src/v3beta1/flows_proto_list.json", + "src/v3beta1/index.ts", + "src/v3beta1/intents_client.ts", + "src/v3beta1/intents_client_config.json", + "src/v3beta1/intents_proto_list.json", + "src/v3beta1/pages_client.ts", + "src/v3beta1/pages_client_config.json", + "src/v3beta1/pages_proto_list.json", + "src/v3beta1/session_entity_types_client.ts", + "src/v3beta1/session_entity_types_client_config.json", + "src/v3beta1/session_entity_types_proto_list.json", + "src/v3beta1/sessions_client.ts", + "src/v3beta1/sessions_client_config.json", + "src/v3beta1/sessions_proto_list.json", + "src/v3beta1/transition_route_groups_client.ts", + "src/v3beta1/transition_route_groups_client_config.json", + "src/v3beta1/transition_route_groups_proto_list.json", + "src/v3beta1/versions_client.ts", + "src/v3beta1/versions_client_config.json", + "src/v3beta1/versions_proto_list.json", + "src/v3beta1/webhooks_client.ts", + "src/v3beta1/webhooks_client_config.json", + "src/v3beta1/webhooks_proto_list.json", + "system-test/fixtures/sample/src/index.js", + "system-test/fixtures/sample/src/index.ts", + "system-test/install.ts", + "test/gapic_agents_v3.ts", + "test/gapic_agents_v3beta1.ts", + "test/gapic_entity_types_v3.ts", + "test/gapic_entity_types_v3beta1.ts", + "test/gapic_environments_v3.ts", + "test/gapic_environments_v3beta1.ts", + "test/gapic_flows_v3.ts", + "test/gapic_flows_v3beta1.ts", + "test/gapic_intents_v3.ts", + "test/gapic_intents_v3beta1.ts", + "test/gapic_pages_v3.ts", + "test/gapic_pages_v3beta1.ts", + "test/gapic_security_settings_service_v3.ts", + "test/gapic_session_entity_types_v3.ts", + "test/gapic_session_entity_types_v3beta1.ts", + "test/gapic_sessions_v3.ts", + "test/gapic_sessions_v3beta1.ts", + "test/gapic_transition_route_groups_v3.ts", + "test/gapic_transition_route_groups_v3beta1.ts", + "test/gapic_versions_v3.ts", + "test/gapic_versions_v3beta1.ts", + "test/gapic_webhooks_v3.ts", + "test/gapic_webhooks_v3beta1.ts", + "tsconfig.json", + "webpack.config.js" ] } \ No newline at end of file diff --git a/synth.py b/synth.py index 22c2d7b8..04451901 100644 --- a/synth.py +++ b/synth.py @@ -23,7 +23,7 @@ gapic = gcp.GAPICBazel() # note: default version must be the last one to generate the correct system test -versions = ['v3'] +versions = ['v3beta1', 'v3'] for version in versions: library = gapic.node_library('dialogflow', version, bazel_target=f"//google/cloud/dialogflow/cx/{version}:dialogflow-cx-{version}-nodejs") diff --git a/test/gapic_agents_v3beta1.ts b/test/gapic_agents_v3beta1.ts new file mode 100644 index 00000000..ee48aec3 --- /dev/null +++ b/test/gapic_agents_v3beta1.ts @@ -0,0 +1,2416 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as agentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.AgentsClient', () => { + it('has servicePath', () => { + const servicePath = agentsModule.v3beta1.AgentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = agentsModule.v3beta1.AgentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = agentsModule.v3beta1.AgentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new agentsModule.v3beta1.AgentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new agentsModule.v3beta1.AgentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + await client.initialize(); + assert(client.agentsStub); + }); + + it('has close method', () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getAgent', () => { + it('invokes getAgent without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ); + client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); + const [response] = await client.getAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAgent without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ); + client.innerApiCalls.getAgent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getAgent with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + assert( + (client.innerApiCalls.getAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createAgent', () => { + it('invokes createAgent without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ); + client.innerApiCalls.createAgent = stubSimpleCall(expectedResponse); + const [response] = await client.createAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createAgent without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ); + client.innerApiCalls.createAgent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createAgent with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateAgentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAgent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createAgent(request), expectedError); + assert( + (client.innerApiCalls.createAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateAgent', () => { + it('invokes updateAgent without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest() + ); + request.agent = {}; + request.agent.name = ''; + const expectedHeaderRequestParams = 'agent.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ); + client.innerApiCalls.updateAgent = stubSimpleCall(expectedResponse); + const [response] = await client.updateAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAgent without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest() + ); + request.agent = {}; + request.agent.name = ''; + const expectedHeaderRequestParams = 'agent.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ); + client.innerApiCalls.updateAgent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateAgent with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateAgentRequest() + ); + request.agent = {}; + request.agent.name = ''; + const expectedHeaderRequestParams = 'agent.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAgent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateAgent(request), expectedError); + assert( + (client.innerApiCalls.updateAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteAgent', () => { + it('invokes deleteAgent without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteAgent without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteAgent( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteAgent with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteAgent(request), expectedError); + assert( + (client.innerApiCalls.deleteAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('exportAgent', () => { + it('invokes exportAgent without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes exportAgent without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAgent = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.exportAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes exportAgent with call error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.exportAgent(request), expectedError); + assert( + (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes exportAgent with LRO error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ExportAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.exportAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkExportAgentProgress without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAgentProgress with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkExportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('restoreAgent', () => { + it('invokes restoreAgent without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes restoreAgent without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreAgent = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.restoreAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes restoreAgent with call error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.restoreAgent(request), expectedError); + assert( + (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes restoreAgent with LRO error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.RestoreAgentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.restoreAgent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkRestoreAgentProgress without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRestoreAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreAgentProgress with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.checkRestoreAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listAgents', () => { + it('invokes listAgents without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + ]; + client.innerApiCalls.listAgents = stubSimpleCall(expectedResponse); + const [response] = await client.listAgents(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listAgents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listAgents without error using callback', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + ]; + client.innerApiCalls.listAgents = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listAgents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IAgent[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listAgents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listAgents with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAgents = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAgents(request), expectedError); + assert( + (client.innerApiCalls.listAgents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listAgentsStream without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + ]; + client.descriptors.page.listAgents.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Agent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Agent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAgents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAgents, request) + ); + assert.strictEqual( + (client.descriptors.page.listAgents.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAgentsStream with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listAgents.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Agent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Agent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAgents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAgents, request) + ); + assert.strictEqual( + (client.descriptors.page.listAgents.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAgents without error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Agent() + ), + ]; + client.descriptors.page.listAgents.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IAgent[] = []; + const iterable = client.listAgentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAgents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listAgents.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAgents with error', async () => { + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListAgentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listAgents.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listAgentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IAgent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAgents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listAgents.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new agentsModule.v3beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_entity_types_v3beta1.ts b/test/gapic_entity_types_v3beta1.ts new file mode 100644 index 00000000..a3ae77ee --- /dev/null +++ b/test/gapic_entity_types_v3beta1.ts @@ -0,0 +1,2009 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as entitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.EntityTypesClient', () => { + it('has servicePath', () => { + const servicePath = entitytypesModule.v3beta1.EntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = entitytypesModule.v3beta1.EntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = entitytypesModule.v3beta1.EntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + await client.initialize(); + assert(client.entityTypesStub); + }); + + it('has close method', () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getEntityType', () => { + it('invokes getEntityType without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ); + client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getEntityType without error using callback', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ); + client.innerApiCalls.getEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getEntityType with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEntityType(request), expectedError); + assert( + (client.innerApiCalls.getEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createEntityType', () => { + it('invokes createEntityType without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ); + client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createEntityType without error using callback', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ); + client.innerApiCalls.createEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createEntityType with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createEntityType(request), expectedError); + assert( + (client.innerApiCalls.createEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateEntityType', () => { + it('invokes updateEntityType without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest() + ); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = 'entity_type.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ); + client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateEntityType without error using callback', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest() + ); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = 'entity_type.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ); + client.innerApiCalls.updateEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateEntityType with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEntityTypeRequest() + ); + request.entityType = {}; + request.entityType.name = ''; + const expectedHeaderRequestParams = 'entity_type.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEntityType(request), expectedError); + assert( + (client.innerApiCalls.updateEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteEntityType', () => { + it('invokes deleteEntityType without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteEntityType without error using callback', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteEntityType( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteEntityType with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteEntityType(request), expectedError); + assert( + (client.innerApiCalls.deleteEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listEntityTypes', () => { + it('invokes listEntityTypes without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listEntityTypes( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.cx.v3beta1.IEntityType[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listEntityTypes with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEntityTypes(request), expectedError); + assert( + (client.innerApiCalls.listEntityTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listEntityTypesStream without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + ]; + client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.EntityType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.EntityType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEntityTypes, request) + ); + assert.strictEqual( + (client.descriptors.page.listEntityTypes + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listEntityTypesStream with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.EntityType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.EntityType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEntityTypes, request) + ); + assert.strictEqual( + (client.descriptors.page.listEntityTypes + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEntityTypes without error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.EntityType() + ), + ]; + client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IEntityType[] = []; + const iterable = client.listEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEntityTypes + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listEntityTypes + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEntityTypes with error', async () => { + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEntityTypes + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listEntityTypes + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new entitytypesModule.v3beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_environments_v3beta1.ts b/test/gapic_environments_v3beta1.ts new file mode 100644 index 00000000..8ac669d8 --- /dev/null +++ b/test/gapic_environments_v3beta1.ts @@ -0,0 +1,2535 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as environmentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.EnvironmentsClient', () => { + it('has servicePath', () => { + const servicePath = + environmentsModule.v3beta1.EnvironmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + environmentsModule.v3beta1.EnvironmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = environmentsModule.v3beta1.EnvironmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + await client.initialize(); + assert(client.environmentsStub); + }); + + it('has close method', () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getEnvironment', () => { + it('invokes getEnvironment without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ); + client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getEnvironment without error using callback', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ); + client.innerApiCalls.getEnvironment = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getEnvironment with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetEnvironmentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEnvironment(request), expectedError); + assert( + (client.innerApiCalls.getEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteEnvironment', () => { + it('invokes deleteEnvironment without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteEnvironment without error using callback', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteEnvironment with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteEnvironmentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteEnvironment(request), expectedError); + assert( + (client.innerApiCalls.deleteEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createEnvironment', () => { + it('invokes createEnvironment without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createEnvironment = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.createEnvironment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createEnvironment without error using callback', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createEnvironment = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createEnvironment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createEnvironment with call error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createEnvironment(request), expectedError); + assert( + (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createEnvironment with LRO error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateEnvironmentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createEnvironment(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateEnvironmentProgress without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + 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.checkCreateEnvironmentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateEnvironmentProgress with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + 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.checkCreateEnvironmentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateEnvironment', () => { + it('invokes updateEnvironment without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest() + ); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = 'environment.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateEnvironment = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.updateEnvironment(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateEnvironment without error using callback', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest() + ); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = 'environment.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateEnvironment = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateEnvironment( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateEnvironment with call error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest() + ); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = 'environment.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEnvironment(request), expectedError); + assert( + (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateEnvironment with LRO error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateEnvironmentRequest() + ); + request.environment = {}; + request.environment.name = ''; + const expectedHeaderRequestParams = 'environment.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateEnvironment(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.updateEnvironment as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUpdateEnvironmentProgress without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + 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.checkUpdateEnvironmentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateEnvironmentProgress with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + 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.checkUpdateEnvironmentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listEnvironments', () => { + it('invokes listEnvironments without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); + const [response] = await client.listEnvironments(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listEnvironments without error using callback', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listEnvironments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listEnvironments with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEnvironments(request), expectedError); + assert( + (client.innerApiCalls.listEnvironments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listEnvironmentsStream without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Environment[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Environment) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEnvironments, request) + ); + assert.strictEqual( + (client.descriptors.page.listEnvironments + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listEnvironmentsStream with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Environment[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Environment) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEnvironments, request) + ); + assert.strictEqual( + (client.descriptors.page.listEnvironments + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEnvironments without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[] = []; + const iterable = client.listEnvironmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEnvironments + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listEnvironments + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listEnvironments with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListEnvironmentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listEnvironmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEnvironments + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listEnvironments + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('lookupEnvironmentHistory', () => { + it('invokes lookupEnvironmentHistory without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.innerApiCalls.lookupEnvironmentHistory = stubSimpleCall( + expectedResponse + ); + const [response] = await client.lookupEnvironmentHistory(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.lookupEnvironmentHistory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes lookupEnvironmentHistory without error using callback', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.innerApiCalls.lookupEnvironmentHistory = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.lookupEnvironmentHistory( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.lookupEnvironmentHistory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes lookupEnvironmentHistory with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.lookupEnvironmentHistory = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.lookupEnvironmentHistory(request), + expectedError + ); + assert( + (client.innerApiCalls.lookupEnvironmentHistory as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes lookupEnvironmentHistoryStream without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.descriptors.page.lookupEnvironmentHistory.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.lookupEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Environment[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Environment) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.lookupEnvironmentHistory + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.lookupEnvironmentHistory, request) + ); + assert.strictEqual( + (client.descriptors.page.lookupEnvironmentHistory + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes lookupEnvironmentHistoryStream with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.lookupEnvironmentHistory.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.lookupEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Environment[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Environment) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.lookupEnvironmentHistory + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.lookupEnvironmentHistory, request) + ); + assert.strictEqual( + (client.descriptors.page.lookupEnvironmentHistory + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with lookupEnvironmentHistory without error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Environment() + ), + ]; + client.descriptors.page.lookupEnvironmentHistory.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[] = []; + const iterable = client.lookupEnvironmentHistoryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.lookupEnvironmentHistory + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.lookupEnvironmentHistory + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with lookupEnvironmentHistory with error', async () => { + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LookupEnvironmentHistoryRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.lookupEnvironmentHistory.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.lookupEnvironmentHistoryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IEnvironment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.lookupEnvironmentHistory + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.lookupEnvironmentHistory + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new environmentsModule.v3beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_flows_v3beta1.ts b/test/gapic_flows_v3beta1.ts new file mode 100644 index 00000000..7b44f86e --- /dev/null +++ b/test/gapic_flows_v3beta1.ts @@ -0,0 +1,2216 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as flowsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.FlowsClient', () => { + it('has servicePath', () => { + const servicePath = flowsModule.v3beta1.FlowsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = flowsModule.v3beta1.FlowsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = flowsModule.v3beta1.FlowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new flowsModule.v3beta1.FlowsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new flowsModule.v3beta1.FlowsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.flowsStub, undefined); + await client.initialize(); + assert(client.flowsStub); + }); + + it('has close method', () => { + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createFlow', () => { + it('invokes createFlow 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.CreateFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ); + client.innerApiCalls.createFlow = stubSimpleCall(expectedResponse); + const [response] = await client.createFlow(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createFlow 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.CreateFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ); + client.innerApiCalls.createFlow = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createFlow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IFlow | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createFlow with 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.CreateFlowRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFlow = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createFlow(request), expectedError); + assert( + (client.innerApiCalls.createFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteFlow', () => { + it('invokes deleteFlow 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.DeleteFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteFlow = stubSimpleCall(expectedResponse); + const [response] = await client.deleteFlow(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteFlow 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.DeleteFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteFlow = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteFlow( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteFlow with 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.DeleteFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFlow = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteFlow(request), expectedError); + assert( + (client.innerApiCalls.deleteFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getFlow', () => { + it('invokes getFlow 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.GetFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ); + client.innerApiCalls.getFlow = stubSimpleCall(expectedResponse); + const [response] = await client.getFlow(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getFlow 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.GetFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ); + client.innerApiCalls.getFlow = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getFlow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IFlow | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getFlow with 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.GetFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFlow = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFlow(request), expectedError); + assert( + (client.innerApiCalls.getFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateFlow', () => { + it('invokes updateFlow 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.UpdateFlowRequest() + ); + request.flow = {}; + request.flow.name = ''; + const expectedHeaderRequestParams = 'flow.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ); + client.innerApiCalls.updateFlow = stubSimpleCall(expectedResponse); + const [response] = await client.updateFlow(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateFlow 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.UpdateFlowRequest() + ); + request.flow = {}; + request.flow.name = ''; + const expectedHeaderRequestParams = 'flow.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ); + client.innerApiCalls.updateFlow = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateFlow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IFlow | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateFlow with 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.UpdateFlowRequest() + ); + request.flow = {}; + request.flow.name = ''; + const expectedHeaderRequestParams = 'flow.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFlow = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFlow(request), expectedError); + assert( + (client.innerApiCalls.updateFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('trainFlow', () => { + it('invokes trainFlow 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.TrainFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.trainFlow = stubLongRunningCall(expectedResponse); + const [operation] = await client.trainFlow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.trainFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes trainFlow 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.TrainFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.trainFlow = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.trainFlow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.trainFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes trainFlow 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.TrainFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.trainFlow = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.trainFlow(request), expectedError); + assert( + (client.innerApiCalls.trainFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes trainFlow 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.TrainFlowRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.trainFlow = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.trainFlow(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.trainFlow as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkTrainFlowProgress 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.checkTrainFlowProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTrainFlowProgress 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.checkTrainFlowProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listFlows', () => { + it('invokes listFlows 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + ]; + client.innerApiCalls.listFlows = stubSimpleCall(expectedResponse); + const [response] = await client.listFlows(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFlows as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFlows 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + ]; + client.innerApiCalls.listFlows = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listFlows( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IFlow[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listFlows as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listFlows with 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFlows = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFlows(request), expectedError); + assert( + (client.innerApiCalls.listFlows as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listFlowsStream 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + ]; + client.descriptors.page.listFlows.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listFlowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Flow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Flow) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listFlows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFlows, request) + ); + assert.strictEqual( + (client.descriptors.page.listFlows.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFlowsStream with 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFlows.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listFlowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Flow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Flow) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFlows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFlows, request) + ); + assert.strictEqual( + (client.descriptors.page.listFlows.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFlows 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Flow() + ), + ]; + client.descriptors.page.listFlows.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IFlow[] = []; + const iterable = client.listFlowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFlows.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listFlows.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFlows with 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.ListFlowsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listFlows.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listFlowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IFlow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFlows.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listFlows.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new flowsModule.v3beta1.FlowsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_intents_v3beta1.ts b/test/gapic_intents_v3beta1.ts new file mode 100644 index 00000000..ef887972 --- /dev/null +++ b/test/gapic_intents_v3beta1.ts @@ -0,0 +1,2002 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as intentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.IntentsClient', () => { + it('has servicePath', () => { + const servicePath = intentsModule.v3beta1.IntentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = intentsModule.v3beta1.IntentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = intentsModule.v3beta1.IntentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new intentsModule.v3beta1.IntentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new intentsModule.v3beta1.IntentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + await client.initialize(); + assert(client.intentsStub); + }); + + it('has close method', () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getIntent', () => { + it('invokes getIntent without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetIntentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ); + client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); + const [response] = await client.getIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getIntent without error using callback', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetIntentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ); + client.innerApiCalls.getIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getIntent with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetIntentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + assert( + (client.innerApiCalls.getIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createIntent', () => { + it('invokes createIntent without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ); + client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); + const [response] = await client.createIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createIntent without error using callback', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ); + client.innerApiCalls.createIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createIntent with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createIntent(request), expectedError); + assert( + (client.innerApiCalls.createIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateIntent', () => { + it('invokes updateIntent without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest() + ); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = 'intent.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ); + client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); + const [response] = await client.updateIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateIntent without error using callback', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest() + ); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = 'intent.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ); + client.innerApiCalls.updateIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateIntent with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateIntentRequest() + ); + request.intent = {}; + request.intent.name = ''; + const expectedHeaderRequestParams = 'intent.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateIntent(request), expectedError); + assert( + (client.innerApiCalls.updateIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteIntent', () => { + it('invokes deleteIntent without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteIntent without error using callback', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteIntent( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteIntent with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteIntent(request), expectedError); + assert( + (client.innerApiCalls.deleteIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listIntents', () => { + it('invokes listIntents without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + ]; + client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); + const [response] = await client.listIntents(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listIntents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listIntents without error using callback', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + ]; + client.innerApiCalls.listIntents = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listIntents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IIntent[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listIntents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listIntents with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listIntents(request), expectedError); + assert( + (client.innerApiCalls.listIntents as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listIntentsStream without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + ]; + client.descriptors.page.listIntents.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Intent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Intent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIntents, request) + ); + assert.strictEqual( + (client.descriptors.page.listIntents.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listIntentsStream with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Intent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Intent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIntents, request) + ); + assert.strictEqual( + (client.descriptors.page.listIntents.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIntents without error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Intent() + ), + ]; + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IIntent[] = []; + const iterable = client.listIntentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listIntents with error', async () => { + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListIntentsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listIntentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IIntent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new intentsModule.v3beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_pages_v3beta1.ts b/test/gapic_pages_v3beta1.ts new file mode 100644 index 00000000..f73bca24 --- /dev/null +++ b/test/gapic_pages_v3beta1.ts @@ -0,0 +1,1993 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as pagesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.PagesClient', () => { + it('has servicePath', () => { + const servicePath = pagesModule.v3beta1.PagesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = pagesModule.v3beta1.PagesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = pagesModule.v3beta1.PagesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new pagesModule.v3beta1.PagesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new pagesModule.v3beta1.PagesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.pagesStub, undefined); + await client.initialize(); + assert(client.pagesStub); + }); + + it('has close method', () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getPage', () => { + it('invokes getPage without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetPageRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ); + client.innerApiCalls.getPage = stubSimpleCall(expectedResponse); + const [response] = await client.getPage(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getPage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getPage without error using callback', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetPageRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ); + client.innerApiCalls.getPage = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getPage( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IPage | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getPage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getPage with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetPageRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getPage = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPage(request), expectedError); + assert( + (client.innerApiCalls.getPage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createPage', () => { + it('invokes createPage without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ); + client.innerApiCalls.createPage = stubSimpleCall(expectedResponse); + const [response] = await client.createPage(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createPage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createPage without error using callback', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ); + client.innerApiCalls.createPage = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createPage( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IPage | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createPage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createPage with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createPage = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createPage(request), expectedError); + assert( + (client.innerApiCalls.createPage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updatePage', () => { + it('invokes updatePage without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest() + ); + request.page = {}; + request.page.name = ''; + const expectedHeaderRequestParams = 'page.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ); + client.innerApiCalls.updatePage = stubSimpleCall(expectedResponse); + const [response] = await client.updatePage(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updatePage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updatePage without error using callback', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest() + ); + request.page = {}; + request.page.name = ''; + const expectedHeaderRequestParams = 'page.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ); + client.innerApiCalls.updatePage = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updatePage( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IPage | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updatePage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updatePage with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdatePageRequest() + ); + request.page = {}; + request.page.name = ''; + const expectedHeaderRequestParams = 'page.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePage = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updatePage(request), expectedError); + assert( + (client.innerApiCalls.updatePage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deletePage', () => { + it('invokes deletePage without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deletePage = stubSimpleCall(expectedResponse); + const [response] = await client.deletePage(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deletePage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deletePage without error using callback', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deletePage = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deletePage( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deletePage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deletePage with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePage = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deletePage(request), expectedError); + assert( + (client.innerApiCalls.deletePage as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listPages', () => { + it('invokes listPages without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + ]; + client.innerApiCalls.listPages = stubSimpleCall(expectedResponse); + const [response] = await client.listPages(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listPages as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listPages without error using callback', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + ]; + client.innerApiCalls.listPages = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listPages( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IPage[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listPages as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listPages with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listPages = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPages(request), expectedError); + assert( + (client.innerApiCalls.listPages as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listPagesStream without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + ]; + client.descriptors.page.listPages.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listPagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Page[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Page) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listPages.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPages, request) + ); + assert.strictEqual( + (client.descriptors.page.listPages.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listPagesStream with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listPages.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listPagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Page[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Page) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listPages.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPages, request) + ); + assert.strictEqual( + (client.descriptors.page.listPages.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listPages without error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Page() + ), + ]; + client.descriptors.page.listPages.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IPage[] = []; + const iterable = client.listPagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPages.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listPages.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listPages with error', async () => { + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListPagesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listPages.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listPagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IPage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPages.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listPages.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new pagesModule.v3beta1.PagesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_session_entity_types_v3beta1.ts b/test/gapic_session_entity_types_v3beta1.ts new file mode 100644 index 00000000..26c8a534 --- /dev/null +++ b/test/gapic_session_entity_types_v3beta1.ts @@ -0,0 +1,2204 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as sessionentitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.SessionEntityTypesClient', () => { + it('has servicePath', () => { + const servicePath = + sessionentitytypesModule.v3beta1.SessionEntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + sessionentitytypesModule.v3beta1.SessionEntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionentitytypesModule.v3beta1.SessionEntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + await client.initialize(); + assert(client.sessionEntityTypesStub); + }); + + it('has close method', () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getSessionEntityType', () => { + it('invokes getSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ); + client.innerApiCalls.getSessionEntityType = stubSimpleCall( + expectedResponse + ); + const [response] = await client.getSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ); + client.innerApiCalls.getSessionEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetSessionEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getSessionEntityType(request), expectedError); + assert( + (client.innerApiCalls.getSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createSessionEntityType', () => { + it('invokes createSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ); + client.innerApiCalls.createSessionEntityType = stubSimpleCall( + expectedResponse + ); + const [response] = await client.createSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ); + client.innerApiCalls.createSessionEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateSessionEntityTypeRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createSessionEntityType(request), + expectedError + ); + assert( + (client.innerApiCalls.createSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateSessionEntityType', () => { + it('invokes updateSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = 'session_entity_type.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall( + expectedResponse + ); + const [response] = await client.updateSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = 'session_entity_type.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ); + client.innerApiCalls.updateSessionEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType = {}; + request.sessionEntityType.name = ''; + const expectedHeaderRequestParams = 'session_entity_type.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateSessionEntityType(request), + expectedError + ); + assert( + (client.innerApiCalls.updateSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteSessionEntityType', () => { + it('invokes deleteSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall( + expectedResponse + ); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteSessionEntityTypeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteSessionEntityType(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteSessionEntityType as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listSessionEntityTypes', () => { + it('invokes listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + ]; + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall( + expectedResponse + ); + const [response] = await client.listSessionEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listSessionEntityTypes without error using callback', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + ]; + client.innerApiCalls.listSessionEntityTypes = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listSessionEntityTypes( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listSessionEntityTypes(request), + expectedError + ); + assert( + (client.innerApiCalls.listSessionEntityTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listSessionEntityTypesStream without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + ]; + client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType[] = []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSessionEntityTypes, request) + ); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listSessionEntityTypesStream with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType[] = []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSessionEntityTypes, request) + ); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.SessionEntityType() + ), + ]; + client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[] = []; + const iterable = client.listSessionEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListSessionEntityTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listSessionEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.ISessionEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new sessionentitytypesModule.v3beta1.SessionEntityTypesClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_sessions_v3beta1.ts b/test/gapic_sessions_v3beta1.ts new file mode 100644 index 00000000..27746fd0 --- /dev/null +++ b/test/gapic_sessions_v3beta1.ts @@ -0,0 +1,1738 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as sessionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +describe('v3beta1.SessionsClient', () => { + it('has servicePath', () => { + const servicePath = sessionsModule.v3beta1.SessionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionsModule.v3beta1.SessionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionsModule.v3beta1.SessionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionsModule.v3beta1.SessionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + await client.initialize(); + assert(client.sessionsStub); + }); + + it('has close method', () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('detectIntent', () => { + it('invokes detectIntent without error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest() + ); + request.session = ''; + const expectedHeaderRequestParams = 'session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse() + ); + client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); + const [response] = await client.detectIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes detectIntent without error using callback', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest() + ); + request.session = ''; + const expectedHeaderRequestParams = 'session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DetectIntentResponse() + ); + client.innerApiCalls.detectIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.detectIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IDetectIntentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes detectIntent with error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DetectIntentRequest() + ); + request.session = ''; + const expectedHeaderRequestParams = 'session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.detectIntent(request), expectedError); + assert( + (client.innerApiCalls.detectIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('matchIntent', () => { + it('invokes matchIntent without error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest() + ); + request.session = ''; + const expectedHeaderRequestParams = 'session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse() + ); + client.innerApiCalls.matchIntent = stubSimpleCall(expectedResponse); + const [response] = await client.matchIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.matchIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes matchIntent without error using callback', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest() + ); + request.session = ''; + const expectedHeaderRequestParams = 'session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse() + ); + client.innerApiCalls.matchIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.matchIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IMatchIntentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.matchIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes matchIntent with error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.MatchIntentRequest() + ); + request.session = ''; + const expectedHeaderRequestParams = 'session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.matchIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.matchIntent(request), expectedError); + assert( + (client.innerApiCalls.matchIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('fulfillIntent', () => { + it('invokes fulfillIntent without error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest() + ); + request.matchIntentRequest = {}; + request.matchIntentRequest.session = ''; + const expectedHeaderRequestParams = 'match_intent_request.session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse() + ); + client.innerApiCalls.fulfillIntent = stubSimpleCall(expectedResponse); + const [response] = await client.fulfillIntent(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.fulfillIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes fulfillIntent without error using callback', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest() + ); + request.matchIntentRequest = {}; + request.matchIntentRequest.session = ''; + const expectedHeaderRequestParams = 'match_intent_request.session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.FulfillIntentResponse() + ); + client.innerApiCalls.fulfillIntent = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.fulfillIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IFulfillIntentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.fulfillIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes fulfillIntent with error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.FulfillIntentRequest() + ); + request.matchIntentRequest = {}; + request.matchIntentRequest.session = ''; + const expectedHeaderRequestParams = 'match_intent_request.session='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.fulfillIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.fulfillIntent(request), expectedError); + assert( + (client.innerApiCalls.fulfillIntent as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('streamingDetectIntent', () => { + it('invokes streamingDetectIntent without error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse() + ); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall( + expectedResponse + ); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0) + .calledWithExactly(undefined) + ); + assert.deepStrictEqual( + (((stream as unknown) as PassThrough)._transform as SinonStub).getCall( + 0 + ).args[0], + request + ); + }); + + it('invokes streamingDetectIntent with error', async () => { + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0) + .calledWithExactly(undefined) + ); + assert.deepStrictEqual( + (((stream as unknown) as PassThrough)._transform as SinonStub).getCall( + 0 + ).args[0], + request + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironmentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionPath', () => { + const result = client.projectLocationAgentEnvironmentSessionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new sessionsModule.v3beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_transition_route_groups_v3beta1.ts b/test/gapic_transition_route_groups_v3beta1.ts new file mode 100644 index 00000000..326738c6 --- /dev/null +++ b/test/gapic_transition_route_groups_v3beta1.ts @@ -0,0 +1,2119 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as transitionroutegroupsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.TransitionRouteGroupsClient', () => { + it('has servicePath', () => { + const servicePath = + transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.transitionRouteGroupsStub, undefined); + await client.initialize(); + assert(client.transitionRouteGroupsStub); + }); + + it('has close method', () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getTransitionRouteGroup', () => { + it('invokes getTransitionRouteGroup without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ); + client.innerApiCalls.getTransitionRouteGroup = stubSimpleCall( + expectedResponse + ); + const [response] = await client.getTransitionRouteGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getTransitionRouteGroup without error using callback', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ); + client.innerApiCalls.getTransitionRouteGroup = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getTransitionRouteGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getTransitionRouteGroup with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetTransitionRouteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getTransitionRouteGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getTransitionRouteGroup(request), + expectedError + ); + assert( + (client.innerApiCalls.getTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createTransitionRouteGroup', () => { + it('invokes createTransitionRouteGroup without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ); + client.innerApiCalls.createTransitionRouteGroup = stubSimpleCall( + expectedResponse + ); + const [response] = await client.createTransitionRouteGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createTransitionRouteGroup without error using callback', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ); + client.innerApiCalls.createTransitionRouteGroup = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createTransitionRouteGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createTransitionRouteGroup with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTransitionRouteGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createTransitionRouteGroup(request), + expectedError + ); + assert( + (client.innerApiCalls.createTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateTransitionRouteGroup', () => { + it('invokes updateTransitionRouteGroup without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest() + ); + request.transitionRouteGroup = {}; + request.transitionRouteGroup.name = ''; + const expectedHeaderRequestParams = 'transition_route_group.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ); + client.innerApiCalls.updateTransitionRouteGroup = stubSimpleCall( + expectedResponse + ); + const [response] = await client.updateTransitionRouteGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateTransitionRouteGroup without error using callback', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest() + ); + request.transitionRouteGroup = {}; + request.transitionRouteGroup.name = ''; + const expectedHeaderRequestParams = 'transition_route_group.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ); + client.innerApiCalls.updateTransitionRouteGroup = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateTransitionRouteGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateTransitionRouteGroup with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateTransitionRouteGroupRequest() + ); + request.transitionRouteGroup = {}; + request.transitionRouteGroup.name = ''; + const expectedHeaderRequestParams = 'transition_route_group.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTransitionRouteGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateTransitionRouteGroup(request), + expectedError + ); + assert( + (client.innerApiCalls.updateTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteTransitionRouteGroup', () => { + it('invokes deleteTransitionRouteGroup without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTransitionRouteGroup = stubSimpleCall( + expectedResponse + ); + const [response] = await client.deleteTransitionRouteGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteTransitionRouteGroup without error using callback', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteTransitionRouteGroup = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteTransitionRouteGroup( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteTransitionRouteGroup with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTransitionRouteGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteTransitionRouteGroup(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteTransitionRouteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listTransitionRouteGroups', () => { + it('invokes listTransitionRouteGroups without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + ]; + client.innerApiCalls.listTransitionRouteGroups = stubSimpleCall( + expectedResponse + ); + const [response] = await client.listTransitionRouteGroups(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listTransitionRouteGroups as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listTransitionRouteGroups without error using callback', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + ]; + client.innerApiCalls.listTransitionRouteGroups = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listTransitionRouteGroups( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listTransitionRouteGroups as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listTransitionRouteGroups with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTransitionRouteGroups = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listTransitionRouteGroups(request), + expectedError + ); + assert( + (client.innerApiCalls.listTransitionRouteGroups as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listTransitionRouteGroupsStream without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + ]; + client.descriptors.page.listTransitionRouteGroups.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listTransitionRouteGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup[] = []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listTransitionRouteGroups + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTransitionRouteGroups, request) + ); + assert.strictEqual( + (client.descriptors.page.listTransitionRouteGroups + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listTransitionRouteGroupsStream with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listTransitionRouteGroups.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listTransitionRouteGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup[] = []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listTransitionRouteGroups + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTransitionRouteGroups, request) + ); + assert.strictEqual( + (client.descriptors.page.listTransitionRouteGroups + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTransitionRouteGroups without error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup() + ), + ]; + client.descriptors.page.listTransitionRouteGroups.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[] = []; + const iterable = client.listTransitionRouteGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listTransitionRouteGroups + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listTransitionRouteGroups + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTransitionRouteGroups with error', async () => { + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listTransitionRouteGroups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listTransitionRouteGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.ITransitionRouteGroup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listTransitionRouteGroups + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listTransitionRouteGroups + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new transitionroutegroupsModule.v3beta1.TransitionRouteGroupsClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_versions_v3beta1.ts b/test/gapic_versions_v3beta1.ts new file mode 100644 index 00000000..abc94aa8 --- /dev/null +++ b/test/gapic_versions_v3beta1.ts @@ -0,0 +1,2314 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as versionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.VersionsClient', () => { + it('has servicePath', () => { + const servicePath = versionsModule.v3beta1.VersionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = versionsModule.v3beta1.VersionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = versionsModule.v3beta1.VersionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new versionsModule.v3beta1.VersionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new versionsModule.v3beta1.VersionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + await client.initialize(); + assert(client.versionsStub); + }); + + it('has close method', () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getVersion with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getVersion(request), expectedError); + assert( + (client.innerApiCalls.getVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateVersion', () => { + it('invokes updateVersion without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest() + ); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = 'version.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ); + client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateVersion without error using callback', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest() + ); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = 'version.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ); + client.innerApiCalls.updateVersion = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateVersion with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest() + ); + request.version = {}; + request.version.name = ''; + const expectedHeaderRequestParams = 'version.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateVersion(request), expectedError); + assert( + (client.innerApiCalls.updateVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteVersion with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteVersion(request), expectedError); + assert( + (client.innerApiCalls.deleteVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createVersion', () => { + it('invokes createVersion without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createVersion = stubLongRunningCall( + expectedResponse + ); + const [operation] = await client.createVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createVersion without error using callback', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createVersion = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.cx.v3beta1.IVersion, + protos.google.cloud.dialogflow.cx.v3beta1.ICreateVersionOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createVersion with call error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createVersion(request), expectedError); + assert( + (client.innerApiCalls.createVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createVersion with LRO error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.createVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkCreateVersionProgress without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + 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.checkCreateVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateVersionProgress with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + 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.checkCreateVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('loadVersion', () => { + it('invokes loadVersion without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.loadVersion = stubLongRunningCall(expectedResponse); + const [operation] = await client.loadVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.loadVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes loadVersion without error using callback', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.loadVersion = stubLongRunningCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.loadVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.loadVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes loadVersion with call error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.loadVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.loadVersion(request), expectedError); + assert( + (client.innerApiCalls.loadVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes loadVersion with LRO error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.LoadVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.loadVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.loadVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.loadVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkLoadVersionProgress without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + 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.checkLoadVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkLoadVersionProgress with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + 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.checkLoadVersionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + ]; + client.innerApiCalls.listVersions = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IVersion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listVersions with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listVersions(request), expectedError); + assert( + (client.innerApiCalls.listVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + ]; + client.descriptors.page.listVersions.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Version[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Version) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listVersions, request) + ); + assert.strictEqual( + (client.descriptors.page.listVersions + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Version[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Version) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listVersions, request) + ); + assert.strictEqual( + (client.descriptors.page.listVersions + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Version() + ), + ]; + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listVersions + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listVersions + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listVersions + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listVersions + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new versionsModule.v3beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/test/gapic_webhooks_v3beta1.ts b/test/gapic_webhooks_v3beta1.ts new file mode 100644 index 00000000..658d6746 --- /dev/null +++ b/test/gapic_webhooks_v3beta1.ts @@ -0,0 +1,2206 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as webhooksModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3beta1.WebhooksClient', () => { + it('has servicePath', () => { + const servicePath = webhooksModule.v3beta1.WebhooksClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = webhooksModule.v3beta1.WebhooksClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = webhooksModule.v3beta1.WebhooksClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new webhooksModule.v3beta1.WebhooksClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webhooksStub, undefined); + await client.initialize(); + assert(client.webhooksStub); + }); + + it('has close method', () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getWebhook', () => { + it('invokes getWebhook without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ); + client.innerApiCalls.getWebhook = stubSimpleCall(expectedResponse); + const [response] = await client.getWebhook(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getWebhook without error using callback', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ); + client.innerApiCalls.getWebhook = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getWebhook( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IWebhook | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getWebhook with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.GetWebhookRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getWebhook = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getWebhook(request), expectedError); + assert( + (client.innerApiCalls.getWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createWebhook', () => { + it('invokes createWebhook without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ); + client.innerApiCalls.createWebhook = stubSimpleCall(expectedResponse); + const [response] = await client.createWebhook(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createWebhook without error using callback', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ); + client.innerApiCalls.createWebhook = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createWebhook( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IWebhook | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createWebhook with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.CreateWebhookRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createWebhook = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createWebhook(request), expectedError); + assert( + (client.innerApiCalls.createWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateWebhook', () => { + it('invokes updateWebhook without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest() + ); + request.webhook = {}; + request.webhook.name = ''; + const expectedHeaderRequestParams = 'webhook.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ); + client.innerApiCalls.updateWebhook = stubSimpleCall(expectedResponse); + const [response] = await client.updateWebhook(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateWebhook without error using callback', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest() + ); + request.webhook = {}; + request.webhook.name = ''; + const expectedHeaderRequestParams = 'webhook.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ); + client.innerApiCalls.updateWebhook = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateWebhook( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IWebhook | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateWebhook with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.UpdateWebhookRequest() + ); + request.webhook = {}; + request.webhook.name = ''; + const expectedHeaderRequestParams = 'webhook.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWebhook = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateWebhook(request), expectedError); + assert( + (client.innerApiCalls.updateWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteWebhook', () => { + it('invokes deleteWebhook without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteWebhook = stubSimpleCall(expectedResponse); + const [response] = await client.deleteWebhook(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteWebhook without error using callback', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteWebhook = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.deleteWebhook( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteWebhook with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.DeleteWebhookRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWebhook = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteWebhook(request), expectedError); + assert( + (client.innerApiCalls.deleteWebhook as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listWebhooks', () => { + it('invokes listWebhooks without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + ]; + client.innerApiCalls.listWebhooks = stubSimpleCall(expectedResponse); + const [response] = await client.listWebhooks(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listWebhooks as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listWebhooks without error using callback', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + ]; + client.innerApiCalls.listWebhooks = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listWebhooks( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3beta1.IWebhook[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listWebhooks as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listWebhooks with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listWebhooks = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listWebhooks(request), expectedError); + assert( + (client.innerApiCalls.listWebhooks as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listWebhooksStream without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + ]; + client.descriptors.page.listWebhooks.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listWebhooksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Webhook[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Webhook) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listWebhooks.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWebhooks, request) + ); + assert.strictEqual( + (client.descriptors.page.listWebhooks + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listWebhooksStream with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listWebhooks.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listWebhooksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.Webhook[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.cx.v3beta1.Webhook) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listWebhooks.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWebhooks, request) + ); + assert.strictEqual( + (client.descriptors.page.listWebhooks + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listWebhooks without error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.Webhook() + ), + ]; + client.descriptors.page.listWebhooks.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IWebhook[] = []; + const iterable = client.listWebhooksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listWebhooks + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listWebhooks + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listWebhooks with error', async () => { + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3beta1.ListWebhooksRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listWebhooks.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listWebhooksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.cx.v3beta1.IWebhook[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listWebhooks + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listWebhooks + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('agent', () => { + const fakePath = '/rendered/path/agent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.agentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.agentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('agentPath', () => { + const result = client.agentPath( + 'projectValue', + 'locationValue', + 'agentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.agentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromAgentName', () => { + const result = client.matchProjectFromAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromAgentName', () => { + const result = client.matchLocationFromAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromAgentName', () => { + const result = client.matchAgentFromAgentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.agentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('entityType', () => { + const fakePath = '/rendered/path/entityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + entity_type: 'entityTypeValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.entityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.entityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('entityTypePath', () => { + const result = client.entityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.entityTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEntityTypeName', () => { + const result = client.matchProjectFromEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEntityTypeName', () => { + const result = client.matchLocationFromEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEntityTypeName', () => { + const result = client.matchAgentFromEntityTypeName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromEntityTypeName', () => { + const result = client.matchEntityTypeFromEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates.entityTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('environment', () => { + const fakePath = '/rendered/path/environment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.environmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.environmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('environmentPath', () => { + const result = client.environmentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.environmentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEnvironmentName', () => { + const result = client.matchProjectFromEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEnvironmentName', () => { + const result = client.matchLocationFromEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromEnvironmentName', () => { + const result = client.matchAgentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromEnvironmentName', () => { + const result = client.matchEnvironmentFromEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates.environmentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('flow', () => { + const fakePath = '/rendered/path/flow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.flowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.flowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('flowPath', () => { + const result = client.flowPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.flowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromFlowName', () => { + const result = client.matchProjectFromFlowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFlowName', () => { + const result = client.matchLocationFromFlowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromFlowName', () => { + const result = client.matchAgentFromFlowName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromFlowName', () => { + const result = client.matchFlowFromFlowName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.flowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('intent', () => { + const fakePath = '/rendered/path/intent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + intent: 'intentValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.intentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.intentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('intentPath', () => { + const result = client.intentPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.intentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromIntentName', () => { + const result = client.matchProjectFromIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromIntentName', () => { + const result = client.matchLocationFromIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromIntentName', () => { + const result = client.matchAgentFromIntentName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromIntentName', () => { + const result = client.matchIntentFromIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + (client.pathTemplates.intentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('page', () => { + const fakePath = '/rendered/path/page'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + page: 'pageValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.pagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.pagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('pagePath', () => { + const result = client.pagePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'pageValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.pagePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPageName', () => { + const result = client.matchProjectFromPageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPageName', () => { + const result = client.matchLocationFromPageName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromPageName', () => { + const result = client.matchAgentFromPageName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromPageName', () => { + const result = client.matchFlowFromPageName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchPageFromPageName', () => { + const result = client.matchPageFromPageName(fakePath); + assert.strictEqual(result, 'pageValue'); + assert( + (client.pathTemplates.pagePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironmentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionPath', () => { + const result = client.projectLocationAgentEnvironmentSessionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + environment: 'environmentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentEnvironmentSessionEntityTypePath', () => { + const result = client.projectLocationAgentEnvironmentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'environmentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEnvironmentFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentEnvironmentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentEnvironmentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'agentValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchAgentFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + (client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('transitionRouteGroup', () => { + const fakePath = '/rendered/path/transitionRouteGroup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + transition_route_group: 'transitionRouteGroupValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.transitionRouteGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.transitionRouteGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('transitionRouteGroupPath', () => { + const result = client.transitionRouteGroupPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'transitionRouteGroupValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromTransitionRouteGroupName', () => { + const result = client.matchProjectFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromTransitionRouteGroupName', () => { + const result = client.matchLocationFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromTransitionRouteGroupName', () => { + const result = client.matchAgentFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromTransitionRouteGroupName', () => { + const result = client.matchFlowFromTransitionRouteGroupName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTransitionRouteGroupFromTransitionRouteGroupName', () => { + const result = client.matchTransitionRouteGroupFromTransitionRouteGroupName( + fakePath + ); + assert.strictEqual(result, 'transitionRouteGroupValue'); + assert( + (client.pathTemplates.transitionRouteGroupPathTemplate + .match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('version', () => { + const fakePath = '/rendered/path/version'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + flow: 'flowValue', + version: 'versionValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.versionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.versionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('versionPath', () => { + const result = client.versionPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'flowValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.versionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromVersionName', () => { + const result = client.matchProjectFromVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromVersionName', () => { + const result = client.matchLocationFromVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromVersionName', () => { + const result = client.matchAgentFromVersionName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchFlowFromVersionName', () => { + const result = client.matchFlowFromVersionName(fakePath); + assert.strictEqual(result, 'flowValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromVersionName', () => { + const result = client.matchVersionFromVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + (client.pathTemplates.versionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('webhook', () => { + const fakePath = '/rendered/path/webhook'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + agent: 'agentValue', + webhook: 'webhookValue', + }; + const client = new webhooksModule.v3beta1.WebhooksClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.webhookPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.webhookPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('webhookPath', () => { + const result = client.webhookPath( + 'projectValue', + 'locationValue', + 'agentValue', + 'webhookValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.webhookPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromWebhookName', () => { + const result = client.matchProjectFromWebhookName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromWebhookName', () => { + const result = client.matchLocationFromWebhookName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAgentFromWebhookName', () => { + const result = client.matchAgentFromWebhookName(fakePath); + assert.strictEqual(result, 'agentValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchWebhookFromWebhookName', () => { + const result = client.matchWebhookFromWebhookName(fakePath); + assert.strictEqual(result, 'webhookValue'); + assert( + (client.pathTemplates.webhookPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});