From 4f882555cdd0243e775589e49f700defe1fa6902 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 22 Nov 2021 13:57:34 -0800 Subject: [PATCH] feat: added API for changelogs docs: clarified semantic of the streaming APIs (#197) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: added API for changelogs docs: clarified semantic of the streaming APIs PiperOrigin-RevId: 404644767 Source-Link: https://github.com/googleapis/googleapis/commit/55fd11bc3d585b73bd9239daa567b5cfd5b84a3e Source-Link: https://github.com/googleapis/googleapis-gen/commit/c9d05e32d9c549b7ce50bd411ae4fc37d7b390e0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzlkMDVlMzJkOWM1NDliN2NlNTBiZDQxMWFlNGZjMzdkN2IzOTBlMCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * build: run generator locally * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: bencoe@google.com --- .github/.OwlBot.lock.yaml | 2 +- .../cloud/dialogflow/cx/v3/audio_config.proto | 50 +- .../dialogflow/cx/v3/security_settings.proto | 12 +- .../cloud/dialogflow/cx/v3/version.proto | 149 +++-- .../cloud/dialogflow/cx/v3/webhook.proto | 185 ++++-- protos/protos.d.ts | 255 +++++++- protos/protos.js | 596 +++++++++++++++++- protos/protos.json | 92 ++- .../generated/v3/versions.compare_versions.js | 72 +++ .../generated/v3/versions.create_version.js | 6 +- .../generated/v3/versions.delete_version.js | 6 +- samples/generated/v3/versions.get_version.js | 4 +- .../generated/v3/versions.list_versions.js | 6 +- samples/generated/v3/versions.load_version.js | 6 +- .../generated/v3/versions.update_version.js | 4 +- .../generated/v3/webhooks.delete_webhook.js | 7 +- src/v3/gapic_metadata.json | 10 + src/v3/versions_client.ts | 162 ++++- src/v3/versions_client_config.json | 5 + src/v3/webhooks_client.ts | 7 +- test/gapic_versions_v3.ts | 111 ++++ 21 files changed, 1518 insertions(+), 229 deletions(-) create mode 100644 samples/generated/v3/versions.compare_versions.js diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 8d0a479d..6dab0bf3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest - digest: sha256:bbb8dd6576ac58830a07fc17e9511ae898be44f2219d3344449b125df9854441 + digest: sha256:c5576a2a649af7ea4f1100e691a44584980e298277467460852c53642354cb80 diff --git a/protos/google/cloud/dialogflow/cx/v3/audio_config.proto b/protos/google/cloud/dialogflow/cx/v3/audio_config.proto index 49e21d92..ea532786 100644 --- a/protos/google/cloud/dialogflow/cx/v3/audio_config.proto +++ b/protos/google/cloud/dialogflow/cx/v3/audio_config.proto @@ -31,6 +31,31 @@ option java_package = "com.google.cloud.dialogflow.cx.v3"; option objc_class_prefix = "DF"; option ruby_package = "Google::Cloud::Dialogflow::CX::V3"; +// 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 @@ -80,31 +105,6 @@ enum AudioEncoding { AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; } -// Information for a word recognized by the speech recognizer. -message SpeechWordInfo { - // The word this info is for. - string word = 3; - - // Time offset relative to the beginning of the audio that corresponds to the - // start of the spoken word. This is an experimental feature and the accuracy - // of the time offset can vary. - google.protobuf.Duration start_offset = 1; - - // Time offset relative to the beginning of the audio that corresponds to the - // end of the spoken word. This is an experimental feature and the accuracy of - // the time offset can vary. - google.protobuf.Duration end_offset = 2; - - // The Speech confidence between 0.0 and 1.0 for this word. A higher number - // indicates an estimated greater likelihood that the recognized word is - // correct. The default of 0.0 is a sentinel value indicating that confidence - // was not set. - // - // This field is not guaranteed to be fully stable over time for the same - // audio input. Users should also not rely on it to always be provided. - float confidence = 4; -} - // Instructs the speech recognizer on how to process the audio content. message InputAudioConfig { // Required. Audio encoding of the audio content to process. diff --git a/protos/google/cloud/dialogflow/cx/v3/security_settings.proto b/protos/google/cloud/dialogflow/cx/v3/security_settings.proto index b3409fd8..f7390def 100644 --- a/protos/google/cloud/dialogflow/cx/v3/security_settings.proto +++ b/protos/google/cloud/dialogflow/cx/v3/security_settings.proto @@ -245,6 +245,11 @@ message SecuritySettings { // [DLP](https://cloud.google.com/dlp/docs) inspect template name. Use this // template to define inspect base settings. // + // The `DLP Inspect Templates Reader` role is needed on the Dialogflow + // service identity service account (has the form + // `service-PROJECT_NUMBER@gcp-sa-dialogflow.iam.gserviceaccount.com`) + // for your agent's project. + // // If empty, we use the default DLP inspect config. // // The template name will have one of the following formats: @@ -261,6 +266,11 @@ message SecuritySettings { // [DLP](https://cloud.google.com/dlp/docs) deidentify template name. Use this // template to define de-identification configuration for the content. // + // The `DLP De-identify Templates Reader` role is needed on the Dialogflow + // service identity service account (has the form + // `service-PROJECT_NUMBER@gcp-sa-dialogflow.iam.gserviceaccount.com`) + // for your agent's project. + // // If empty, Dialogflow replaces sensitive info with `[redacted]` text. // // The template name will have one of the following formats: @@ -281,7 +291,7 @@ message SecuritySettings { // Retains data in interaction logging for the specified number of days. // This does not apply to Cloud logging, which is owned by the user - not // Dialogflow. - // User must Set a value lower than Dialogflow's default 30d TTL. Setting a + // User must set a value lower than Dialogflow's default 365d TTL. Setting a // value higher than that has no effect. // A missing value or setting to 0 also means we use Dialogflow's default // TTL. diff --git a/protos/google/cloud/dialogflow/cx/v3/version.proto b/protos/google/cloud/dialogflow/cx/v3/version.proto index a1aecc65..628d37db 100644 --- a/protos/google/cloud/dialogflow/cx/v3/version.proto +++ b/protos/google/cloud/dialogflow/cx/v3/version.proto @@ -47,7 +47,8 @@ service Versions { "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.v3.Flow]. + // Returns the list of all versions in the specified + // [Flow][google.cloud.dialogflow.cx.v3.Flow]. rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { option (google.api.http) = { get: "/v3/{parent=projects/*/locations/*/agents/*/flows/*}/versions" @@ -63,15 +64,18 @@ service Versions { option (google.api.method_signature) = "name"; } - // Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. + // Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified + // [Flow][google.cloud.dialogflow.cx.v3.Flow]. // // This method is a [long-running // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned `Operation` type has the following method-specific fields: // - // - `metadata`: [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata] + // - `metadata`: + // [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata] // - `response`: [Version][google.cloud.dialogflow.cx.v3.Version] - rpc CreateVersion(CreateVersionRequest) returns (google.longrunning.Operation) { + rpc CreateVersion(CreateVersionRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v3/{parent=projects/*/locations/*/agents/*/flows/*}/versions" body: "version" @@ -121,17 +125,27 @@ service Versions { metadata_type: "google.protobuf.Struct" }; } + + // Compares the specified base version with target version. + rpc CompareVersions(CompareVersionsRequest) + returns (CompareVersionsResponse) { + option (google.api.http) = { + post: "/v3/{base_version=projects/*/locations/*/agents/*/flows/*/versions/*}:compareVersions" + body: "*" + }; + option (google.api.method_signature) = "base_version"; + } } // Metadata associated with the long running operation for // [Versions.CreateVersion][google.cloud.dialogflow.cx.v3.Versions.CreateVersion]. message CreateVersionOperationMetadata { // Name of the created version. - // Format: `projects//locations//agents//flows//versions/`. + // Format: + // `projects//locations//agents//flows//versions/`. string version = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Version" - }]; + type: "dialogflow.googleapis.com/Version" + }]; } // Represents a version of a flow. @@ -156,9 +170,10 @@ message Version { FAILED = 3; } - // Format: projects//locations//agents//flows//versions/. Version ID is a self-increasing - // number generated by Dialogflow upon version creation. + // 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. @@ -172,18 +187,20 @@ message Version { 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]; + 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. + // 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.v3.Versions.ListVersions]. +// The request message for +// [Versions.ListVersions][google.cloud.dialogflow.cx.v3.Versions.ListVersions]. message ListVersionsRequest { - // Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all versions for. - // Format: `projects//locations//agents//flows/`. + // Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all + // versions for. Format: + // `projects//locations//agents//flows/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -199,7 +216,8 @@ message ListVersionsRequest { string page_token = 3; } -// The response message for [Versions.ListVersions][google.cloud.dialogflow.cx.v3.Versions.ListVersions]. +// The response message for +// [Versions.ListVersions][google.cloud.dialogflow.cx.v3.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 @@ -211,11 +229,12 @@ message ListVersionsResponse { string next_page_token = 2; } -// The request message for [Versions.GetVersion][google.cloud.dialogflow.cx.v3.Versions.GetVersion]. +// The request message for +// [Versions.GetVersion][google.cloud.dialogflow.cx.v3.Versions.GetVersion]. message GetVersionRequest { // Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. - // Format: `projects//locations//agents//flows//versions/`. + // Format: + // `projects//locations//agents//flows//versions/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -224,11 +243,12 @@ message GetVersionRequest { ]; } -// The request message for [Versions.CreateVersion][google.cloud.dialogflow.cx.v3.Versions.CreateVersion]. +// The request message for +// [Versions.CreateVersion][google.cloud.dialogflow.cx.v3.Versions.CreateVersion]. message CreateVersionRequest { - // Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an [Version][google.cloud.dialogflow.cx.v3.Version] for. - // Format: `projects//locations//agents//flows/`. + // Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an + // [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: + // `projects//locations//agents//flows/`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -240,21 +260,24 @@ message CreateVersionRequest { Version version = 2 [(google.api.field_behavior) = REQUIRED]; } -// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.cx.v3.Versions.UpdateVersion]. +// The request message for +// [Versions.UpdateVersion][google.cloud.dialogflow.cx.v3.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]; + // 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.v3.Versions.DeleteVersion]. +// The request message for +// [Versions.DeleteVersion][google.cloud.dialogflow.cx.v3.Versions.DeleteVersion]. message DeleteVersionRequest { - // Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] to delete. - // Format: `projects//locations//agents//flows//versions/`. + // Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] + // to delete. Format: + // `projects//locations//agents//flows//versions/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -263,11 +286,12 @@ message DeleteVersionRequest { ]; } -// The request message for [Versions.LoadVersion][google.cloud.dialogflow.cx.v3.Versions.LoadVersion]. +// The request message for +// [Versions.LoadVersion][google.cloud.dialogflow.cx.v3.Versions.LoadVersion]. message LoadVersionRequest { - // Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded to draft flow. - // Format: `projects//locations//agents//flows//versions/`. + // Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded + // to draft flow. Format: + // `projects//locations//agents//flows//versions/`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -281,3 +305,52 @@ message LoadVersionRequest { // will not be overridden (i.e. intents, entities, webhooks). bool allow_override_agent_resources = 2; } + +// The request message for +// [Versions.CompareVersions][google.cloud.dialogflow.cx.v3.Versions.CompareVersions]. +message CompareVersionsRequest { + // Required. Name of the base flow version to compare with the target version. + // Use version ID `0` to indicate the draft version of the specified flow. + // + // Format: + // `projects//locations//agents//flows//versions/`. + string base_version = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + + // Required. Name of the target flow version to compare with the + // base version. Use version ID `0` to indicate the draft version of the + // specified flow. Format: + // `projects//locations//agents//flows//versions/`. + string target_version = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + + // The language to compare the flow versions for. + // + // 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 response message for +// [Versions.CompareVersions][google.cloud.dialogflow.cx.v3.Versions.CompareVersions]. +message CompareVersionsResponse { + // JSON representation of the base version content. + string base_version_content_json = 1; + + // JSON representation of the target version content. + string target_version_content_json = 2; + + // The timestamp when the two version compares. + google.protobuf.Timestamp compare_time = 3; +} diff --git a/protos/google/cloud/dialogflow/cx/v3/webhook.proto b/protos/google/cloud/dialogflow/cx/v3/webhook.proto index 074b8dc1..7f2a291f 100644 --- a/protos/google/cloud/dialogflow/cx/v3/webhook.proto +++ b/protos/google/cloud/dialogflow/cx/v3/webhook.proto @@ -101,7 +101,8 @@ message Webhook { // Represents configuration for a generic web service. message GenericWebService { - // Required. The webhook URI for receiving POST requests. It must use https protocol. + // 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. @@ -113,6 +114,20 @@ message Webhook { // The HTTP request headers to send together with webhook // requests. map request_headers = 4; + + // Optional. Specifies a list of allowed custom CA certificates (in DER + // format) for HTTPS verification. This overrides the default SSL trust + // store. If this is empty or unspecified, Dialogflow will use Google's + // default trust store to verify certificates. N.B. Make sure the HTTPS + // server certificates are signed with "subject alt name". For instance a + // certificate can be self-signed using the following command, + // + // openssl x509 -req -days 200 -in example.com.csr \ + // -signkey example.com.key \ + // -out example.com.crt \ + // -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") + repeated bytes allowed_ca_certs = 5 + [(google.api.field_behavior) = OPTIONAL]; } // Represents configuration for a [Service @@ -136,10 +151,12 @@ message Webhook { } // The unique identifier of the webhook. - // Required for the [Webhooks.UpdateWebhook][google.cloud.dialogflow.cx.v3.Webhooks.UpdateWebhook] method. - // [Webhooks.CreateWebhook][google.cloud.dialogflow.cx.v3.Webhooks.CreateWebhook] populates the name automatically. - // Format: `projects//locations//agents//webhooks/`. + // Required for the + // [Webhooks.UpdateWebhook][google.cloud.dialogflow.cx.v3.Webhooks.UpdateWebhook] + // method. + // [Webhooks.CreateWebhook][google.cloud.dialogflow.cx.v3.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. @@ -164,7 +181,8 @@ message Webhook { bool disabled = 5; } -// The request message for [Webhooks.ListWebhooks][google.cloud.dialogflow.cx.v3.Webhooks.ListWebhooks]. +// The request message for +// [Webhooks.ListWebhooks][google.cloud.dialogflow.cx.v3.Webhooks.ListWebhooks]. message ListWebhooksRequest { // Required. The agent to list all webhooks for. // Format: `projects//locations//agents/`. @@ -183,7 +201,8 @@ message ListWebhooksRequest { string page_token = 3; } -// The response message for [Webhooks.ListWebhooks][google.cloud.dialogflow.cx.v3.Webhooks.ListWebhooks]. +// The response message for +// [Webhooks.ListWebhooks][google.cloud.dialogflow.cx.v3.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. @@ -194,7 +213,8 @@ message ListWebhooksResponse { string next_page_token = 2; } -// The request message for [Webhooks.GetWebhook][google.cloud.dialogflow.cx.v3.Webhooks.GetWebhook]. +// The request message for +// [Webhooks.GetWebhook][google.cloud.dialogflow.cx.v3.Webhooks.GetWebhook]. message GetWebhookRequest { // Required. The name of the webhook. // Format: `projects//locations//agents//locations//agents/`. @@ -222,7 +243,8 @@ message CreateWebhookRequest { Webhook webhook = 2 [(google.api.field_behavior) = REQUIRED]; } -// The request message for [Webhooks.UpdateWebhook][google.cloud.dialogflow.cx.v3.Webhooks.UpdateWebhook]. +// The request message for +// [Webhooks.UpdateWebhook][google.cloud.dialogflow.cx.v3.Webhooks.UpdateWebhook]. message UpdateWebhookRequest { // Required. The webhook to update. Webhook webhook = 1 [(google.api.field_behavior) = REQUIRED]; @@ -232,7 +254,8 @@ message UpdateWebhookRequest { google.protobuf.FieldMask update_mask = 2; } -// The request message for [Webhooks.DeleteWebhook][google.cloud.dialogflow.cx.v3.Webhooks.DeleteWebhook]. +// The request message for +// [Webhooks.DeleteWebhook][google.cloud.dialogflow.cx.v3.Webhooks.DeleteWebhook]. message DeleteWebhookRequest { // Required. The name of the webhook to delete. // Format: `projects//locations//agents//locations//agents//intents/`. string last_matched_intent = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - }]; + type: "dialogflow.googleapis.com/Intent" + }]; - // Always present. The display name of the last matched [intent][google.cloud.dialogflow.cx.v3.Intent]. + // Always present. The display name of the last matched + // [intent][google.cloud.dialogflow.cx.v3.Intent]. string display_name = 3; // Parameters identified as a result of intent matching. This is a map of @@ -312,30 +337,32 @@ message WebhookRequest { float magnitude = 2; } - // Always present. The unique identifier of the [DetectIntentResponse][google.cloud.dialogflow.cx.v3.DetectIntentResponse] that - // will be returned to the API caller. + // Always present. The unique identifier of the + // [DetectIntentResponse][google.cloud.dialogflow.cx.v3.DetectIntentResponse] + // that will be returned to the API caller. string detect_intent_response_id = 1; // The original conversational query. oneof query { - // If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was provided as input, this field - // will contain a copy of the text. + // If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + // provided as input, this field will contain a copy of the text. string text = 10; - // If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as input, this field will - // contain a copy of the intent identifier. - // Format: `projects//locations//agents//locations//agents//intents/`. string trigger_intent = 11 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - }]; + type: "dialogflow.googleapis.com/Intent" + }]; - // If [natural language speech audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + // If [natural language speech + // audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, // this field will contain the transcript for the audio. string transcript = 12; - // If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as input, this field will contain - // the name of the event. + // If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + // input, this field will contain the name of the event. string trigger_event = 14; } @@ -361,7 +388,8 @@ message WebhookRequest { // [WebhookResponse.fulfillment_response][google.cloud.dialogflow.cx.v3.WebhookResponse.fulfillment_response]; repeated ResponseMessage messages = 7; - // Custom data set in [QueryParameters.payload][google.cloud.dialogflow.cx.v3.QueryParameters.payload]. + // Custom data set in + // [QueryParameters.payload][google.cloud.dialogflow.cx.v3.QueryParameters.payload]. google.protobuf.Struct payload = 8; // The sentiment analysis result of the current user request. The field is @@ -406,7 +434,8 @@ message WebhookResponse { // 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.v3.QueryResult.webhook_payloads]. + // Value to append directly to + // [QueryResult.webhook_payloads][google.cloud.dialogflow.cx.v3.QueryResult.webhook_payloads]. google.protobuf.Struct payload = 4; // The target to transition to. This can be set optionally to indicate an @@ -417,15 +446,15 @@ message WebhookResponse { // Format: `projects//locations//agents//flows//pages/`. string target_page = 5 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Page" - }]; + 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" - }]; + type: "dialogflow.googleapis.com/Flow" + }]; } } @@ -452,73 +481,95 @@ message PageInfo { FILLED = 3; } - // Always present for [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Required for + // Always present for + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + // Required for // [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + // Optional for both + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + // [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest]. Required for - // [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The state of the parameter. This field can be set - // to [INVALID][google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState.INVALID] by - // the webhook to invalidate the parameter; other values set by the + // Always present for + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + // Required for + // [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + // state of the parameter. This field can be set to + // [INVALID][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. - // The value of the parameter. This field can be set by the webhook to - // change the parameter value. + // Optional for both + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + // [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest]. Ignored for [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + // Optional for + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored + // for [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. - // The parameters contained in the form. Note that the webhook cannot add - // or remove any form parameter. + // Optional for both + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + // [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest]. Ignored for [WebhookResponse][google.cloud.dialogflow.cx.v3.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" - }]; + // Always present for + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + // [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest] and [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + // Optional for both + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + // [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookRequest]. Ignored for [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. - // The unique identifier of the [session][google.cloud.dialogflow.cx.v3.DetectIntentRequest.session]. This + // Always present for + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + // [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + // unique identifier of the + // [session][google.cloud.dialogflow.cx.v3.DetectIntentRequest.session]. This // field can be used by the webhook to identify a session. // Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/` // if environment is specified. string session = 1 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Session" - }]; - - // Optional for [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Optional for [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.WebhookResponse]. The map is keyed by parameters' - // display names. + type: "dialogflow.googleapis.com/Session" + }]; + + // Optional for + // [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Optional + // for [WebhookResponse][google.cloud.dialogflow.cx.v3.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.v3.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 5480656b..c337a981 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -7748,18 +7748,6 @@ export namespace google { } } - /** AudioEncoding enum. */ - enum AudioEncoding { - AUDIO_ENCODING_UNSPECIFIED = 0, - AUDIO_ENCODING_LINEAR_16 = 1, - AUDIO_ENCODING_FLAC = 2, - AUDIO_ENCODING_MULAW = 3, - AUDIO_ENCODING_AMR = 4, - AUDIO_ENCODING_AMR_WB = 5, - AUDIO_ENCODING_OGG_OPUS = 6, - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 - } - /** Properties of a SpeechWordInfo. */ interface ISpeechWordInfo { @@ -7868,6 +7856,18 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + /** Properties of an InputAudioConfig. */ interface IInputAudioConfig { @@ -24408,6 +24408,20 @@ export namespace google { * @returns Promise */ public loadVersion(request: google.cloud.dialogflow.cx.v3.ILoadVersionRequest): Promise; + + /** + * Calls CompareVersions. + * @param request CompareVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompareVersionsResponse + */ + public compareVersions(request: google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, callback: google.cloud.dialogflow.cx.v3.Versions.CompareVersionsCallback): void; + + /** + * Calls CompareVersions. + * @param request CompareVersionsRequest message or plain object + * @returns Promise + */ + public compareVersions(request: google.cloud.dialogflow.cx.v3.ICompareVersionsRequest): Promise; } namespace Versions { @@ -24453,6 +24467,13 @@ export namespace google { * @param [response] Operation */ type LoadVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3.Versions#compareVersions}. + * @param error Error, if any + * @param [response] CompareVersionsResponse + */ + type CompareVersionsCallback = (error: (Error|null), response?: google.cloud.dialogflow.cx.v3.CompareVersionsResponse) => void; } /** Properties of a CreateVersionOperationMetadata. */ @@ -25342,6 +25363,210 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a CompareVersionsRequest. */ + interface ICompareVersionsRequest { + + /** CompareVersionsRequest baseVersion */ + baseVersion?: (string|null); + + /** CompareVersionsRequest targetVersion */ + targetVersion?: (string|null); + + /** CompareVersionsRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CompareVersionsRequest. */ + class CompareVersionsRequest implements ICompareVersionsRequest { + + /** + * Constructs a new CompareVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3.ICompareVersionsRequest); + + /** CompareVersionsRequest baseVersion. */ + public baseVersion: string; + + /** CompareVersionsRequest targetVersion. */ + public targetVersion: string; + + /** CompareVersionsRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CompareVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CompareVersionsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3.ICompareVersionsRequest): google.cloud.dialogflow.cx.v3.CompareVersionsRequest; + + /** + * Encodes the specified CompareVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsRequest.verify|verify} messages. + * @param message CompareVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompareVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsRequest.verify|verify} messages. + * @param message CompareVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompareVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompareVersionsRequest + * @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.v3.CompareVersionsRequest; + + /** + * Decodes a CompareVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompareVersionsRequest + * @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.v3.CompareVersionsRequest; + + /** + * Verifies a CompareVersionsRequest 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 CompareVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompareVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3.CompareVersionsRequest; + + /** + * Creates a plain object from a CompareVersionsRequest message. Also converts values to other types if specified. + * @param message CompareVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3.CompareVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompareVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CompareVersionsResponse. */ + interface ICompareVersionsResponse { + + /** CompareVersionsResponse baseVersionContentJson */ + baseVersionContentJson?: (string|null); + + /** CompareVersionsResponse targetVersionContentJson */ + targetVersionContentJson?: (string|null); + + /** CompareVersionsResponse compareTime */ + compareTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CompareVersionsResponse. */ + class CompareVersionsResponse implements ICompareVersionsResponse { + + /** + * Constructs a new CompareVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.cx.v3.ICompareVersionsResponse); + + /** CompareVersionsResponse baseVersionContentJson. */ + public baseVersionContentJson: string; + + /** CompareVersionsResponse targetVersionContentJson. */ + public targetVersionContentJson: string; + + /** CompareVersionsResponse compareTime. */ + public compareTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CompareVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns CompareVersionsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.cx.v3.ICompareVersionsResponse): google.cloud.dialogflow.cx.v3.CompareVersionsResponse; + + /** + * Encodes the specified CompareVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsResponse.verify|verify} messages. + * @param message CompareVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompareVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsResponse.verify|verify} messages. + * @param message CompareVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompareVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompareVersionsResponse + * @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.v3.CompareVersionsResponse; + + /** + * Decodes a CompareVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompareVersionsResponse + * @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.v3.CompareVersionsResponse; + + /** + * Verifies a CompareVersionsResponse 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 CompareVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompareVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.cx.v3.CompareVersionsResponse; + + /** + * Creates a plain object from a CompareVersionsResponse message. Also converts values to other types if specified. + * @param message CompareVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.cx.v3.CompareVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompareVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents a Webhooks */ class Webhooks extends $protobuf.rpc.Service { @@ -25610,6 +25835,9 @@ export namespace google { /** GenericWebService requestHeaders */ requestHeaders?: ({ [k: string]: string }|null); + + /** GenericWebService allowedCaCerts */ + allowedCaCerts?: (Uint8Array[]|null); } /** Represents a GenericWebService. */ @@ -25633,6 +25861,9 @@ export namespace google { /** GenericWebService requestHeaders. */ public requestHeaders: { [k: string]: string }; + /** GenericWebService allowedCaCerts. */ + public allowedCaCerts: Uint8Array[]; + /** * Creates a new GenericWebService instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index ad533d03..1ea3f2e8 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -18081,32 +18081,6 @@ return SecuritySettings; })(); - /** - * AudioEncoding enum. - * @name google.cloud.dialogflow.cx.v3.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 - */ - v3.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; - })(); - v3.SpeechWordInfo = (function() { /** @@ -18371,6 +18345,32 @@ return SpeechWordInfo; })(); + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.cx.v3.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 + */ + v3.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; + })(); + v3.InputAudioConfig = (function() { /** @@ -57308,6 +57308,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.dialogflow.cx.v3.Versions#compareVersions}. + * @memberof google.cloud.dialogflow.cx.v3.Versions + * @typedef CompareVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.cx.v3.CompareVersionsResponse} [response] CompareVersionsResponse + */ + + /** + * Calls CompareVersions. + * @function compareVersions + * @memberof google.cloud.dialogflow.cx.v3.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsRequest} request CompareVersionsRequest message or plain object + * @param {google.cloud.dialogflow.cx.v3.Versions.CompareVersionsCallback} callback Node-style callback called with the error, if any, and CompareVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.compareVersions = function compareVersions(request, callback) { + return this.rpcCall(compareVersions, $root.google.cloud.dialogflow.cx.v3.CompareVersionsRequest, $root.google.cloud.dialogflow.cx.v3.CompareVersionsResponse, request, callback); + }, "name", { value: "CompareVersions" }); + + /** + * Calls CompareVersions. + * @function compareVersions + * @memberof google.cloud.dialogflow.cx.v3.Versions + * @instance + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsRequest} request CompareVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Versions; })(); @@ -59329,6 +59362,475 @@ return LoadVersionRequest; })(); + v3.CompareVersionsRequest = (function() { + + /** + * Properties of a CompareVersionsRequest. + * @memberof google.cloud.dialogflow.cx.v3 + * @interface ICompareVersionsRequest + * @property {string|null} [baseVersion] CompareVersionsRequest baseVersion + * @property {string|null} [targetVersion] CompareVersionsRequest targetVersion + * @property {string|null} [languageCode] CompareVersionsRequest languageCode + */ + + /** + * Constructs a new CompareVersionsRequest. + * @memberof google.cloud.dialogflow.cx.v3 + * @classdesc Represents a CompareVersionsRequest. + * @implements ICompareVersionsRequest + * @constructor + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsRequest=} [properties] Properties to set + */ + function CompareVersionsRequest(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]]; + } + + /** + * CompareVersionsRequest baseVersion. + * @member {string} baseVersion + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @instance + */ + CompareVersionsRequest.prototype.baseVersion = ""; + + /** + * CompareVersionsRequest targetVersion. + * @member {string} targetVersion + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @instance + */ + CompareVersionsRequest.prototype.targetVersion = ""; + + /** + * CompareVersionsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @instance + */ + CompareVersionsRequest.prototype.languageCode = ""; + + /** + * Creates a new CompareVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3.CompareVersionsRequest} CompareVersionsRequest instance + */ + CompareVersionsRequest.create = function create(properties) { + return new CompareVersionsRequest(properties); + }; + + /** + * Encodes the specified CompareVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsRequest} message CompareVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompareVersionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.baseVersion != null && Object.hasOwnProperty.call(message, "baseVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.baseVersion); + if (message.targetVersion != null && Object.hasOwnProperty.call(message, "targetVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetVersion); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CompareVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsRequest} message CompareVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompareVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompareVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @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.v3.CompareVersionsRequest} CompareVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompareVersionsRequest.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.v3.CompareVersionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVersion = reader.string(); + break; + case 2: + message.targetVersion = reader.string(); + break; + case 3: + message.languageCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompareVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3.CompareVersionsRequest} CompareVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompareVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompareVersionsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompareVersionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.baseVersion != null && message.hasOwnProperty("baseVersion")) + if (!$util.isString(message.baseVersion)) + return "baseVersion: string expected"; + if (message.targetVersion != null && message.hasOwnProperty("targetVersion")) + if (!$util.isString(message.targetVersion)) + return "targetVersion: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CompareVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3.CompareVersionsRequest} CompareVersionsRequest + */ + CompareVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3.CompareVersionsRequest) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3.CompareVersionsRequest(); + if (object.baseVersion != null) + message.baseVersion = String(object.baseVersion); + if (object.targetVersion != null) + message.targetVersion = String(object.targetVersion); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CompareVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @static + * @param {google.cloud.dialogflow.cx.v3.CompareVersionsRequest} message CompareVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompareVersionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.baseVersion = ""; + object.targetVersion = ""; + object.languageCode = ""; + } + if (message.baseVersion != null && message.hasOwnProperty("baseVersion")) + object.baseVersion = message.baseVersion; + if (message.targetVersion != null && message.hasOwnProperty("targetVersion")) + object.targetVersion = message.targetVersion; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CompareVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + CompareVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompareVersionsRequest; + })(); + + v3.CompareVersionsResponse = (function() { + + /** + * Properties of a CompareVersionsResponse. + * @memberof google.cloud.dialogflow.cx.v3 + * @interface ICompareVersionsResponse + * @property {string|null} [baseVersionContentJson] CompareVersionsResponse baseVersionContentJson + * @property {string|null} [targetVersionContentJson] CompareVersionsResponse targetVersionContentJson + * @property {google.protobuf.ITimestamp|null} [compareTime] CompareVersionsResponse compareTime + */ + + /** + * Constructs a new CompareVersionsResponse. + * @memberof google.cloud.dialogflow.cx.v3 + * @classdesc Represents a CompareVersionsResponse. + * @implements ICompareVersionsResponse + * @constructor + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsResponse=} [properties] Properties to set + */ + function CompareVersionsResponse(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]]; + } + + /** + * CompareVersionsResponse baseVersionContentJson. + * @member {string} baseVersionContentJson + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @instance + */ + CompareVersionsResponse.prototype.baseVersionContentJson = ""; + + /** + * CompareVersionsResponse targetVersionContentJson. + * @member {string} targetVersionContentJson + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @instance + */ + CompareVersionsResponse.prototype.targetVersionContentJson = ""; + + /** + * CompareVersionsResponse compareTime. + * @member {google.protobuf.ITimestamp|null|undefined} compareTime + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @instance + */ + CompareVersionsResponse.prototype.compareTime = null; + + /** + * Creates a new CompareVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.cx.v3.CompareVersionsResponse} CompareVersionsResponse instance + */ + CompareVersionsResponse.create = function create(properties) { + return new CompareVersionsResponse(properties); + }; + + /** + * Encodes the specified CompareVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsResponse} message CompareVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompareVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.baseVersionContentJson != null && Object.hasOwnProperty.call(message, "baseVersionContentJson")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.baseVersionContentJson); + if (message.targetVersionContentJson != null && Object.hasOwnProperty.call(message, "targetVersionContentJson")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetVersionContentJson); + if (message.compareTime != null && Object.hasOwnProperty.call(message, "compareTime")) + $root.google.protobuf.Timestamp.encode(message.compareTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CompareVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.cx.v3.CompareVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3.ICompareVersionsResponse} message CompareVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompareVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompareVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @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.v3.CompareVersionsResponse} CompareVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompareVersionsResponse.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.v3.CompareVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVersionContentJson = reader.string(); + break; + case 2: + message.targetVersionContentJson = reader.string(); + break; + case 3: + message.compareTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompareVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.cx.v3.CompareVersionsResponse} CompareVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompareVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompareVersionsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompareVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.baseVersionContentJson != null && message.hasOwnProperty("baseVersionContentJson")) + if (!$util.isString(message.baseVersionContentJson)) + return "baseVersionContentJson: string expected"; + if (message.targetVersionContentJson != null && message.hasOwnProperty("targetVersionContentJson")) + if (!$util.isString(message.targetVersionContentJson)) + return "targetVersionContentJson: string expected"; + if (message.compareTime != null && message.hasOwnProperty("compareTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.compareTime); + if (error) + return "compareTime." + error; + } + return null; + }; + + /** + * Creates a CompareVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.cx.v3.CompareVersionsResponse} CompareVersionsResponse + */ + CompareVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.cx.v3.CompareVersionsResponse) + return object; + var message = new $root.google.cloud.dialogflow.cx.v3.CompareVersionsResponse(); + if (object.baseVersionContentJson != null) + message.baseVersionContentJson = String(object.baseVersionContentJson); + if (object.targetVersionContentJson != null) + message.targetVersionContentJson = String(object.targetVersionContentJson); + if (object.compareTime != null) { + if (typeof object.compareTime !== "object") + throw TypeError(".google.cloud.dialogflow.cx.v3.CompareVersionsResponse.compareTime: object expected"); + message.compareTime = $root.google.protobuf.Timestamp.fromObject(object.compareTime); + } + return message; + }; + + /** + * Creates a plain object from a CompareVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @static + * @param {google.cloud.dialogflow.cx.v3.CompareVersionsResponse} message CompareVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompareVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.baseVersionContentJson = ""; + object.targetVersionContentJson = ""; + object.compareTime = null; + } + if (message.baseVersionContentJson != null && message.hasOwnProperty("baseVersionContentJson")) + object.baseVersionContentJson = message.baseVersionContentJson; + if (message.targetVersionContentJson != null && message.hasOwnProperty("targetVersionContentJson")) + object.targetVersionContentJson = message.targetVersionContentJson; + if (message.compareTime != null && message.hasOwnProperty("compareTime")) + object.compareTime = $root.google.protobuf.Timestamp.toObject(message.compareTime, options); + return object; + }; + + /** + * Converts this CompareVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.cx.v3.CompareVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + CompareVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CompareVersionsResponse; + })(); + v3.Webhooks = (function() { /** @@ -59876,6 +60378,7 @@ * @property {string|null} [username] GenericWebService username * @property {string|null} [password] GenericWebService password * @property {Object.|null} [requestHeaders] GenericWebService requestHeaders + * @property {Array.|null} [allowedCaCerts] GenericWebService allowedCaCerts */ /** @@ -59888,6 +60391,7 @@ */ function GenericWebService(properties) { this.requestHeaders = {}; + this.allowedCaCerts = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -59926,6 +60430,14 @@ */ GenericWebService.prototype.requestHeaders = $util.emptyObject; + /** + * GenericWebService allowedCaCerts. + * @member {Array.} allowedCaCerts + * @memberof google.cloud.dialogflow.cx.v3.Webhook.GenericWebService + * @instance + */ + GenericWebService.prototype.allowedCaCerts = $util.emptyArray; + /** * Creates a new GenericWebService instance using the specified properties. * @function create @@ -59959,6 +60471,9 @@ 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(); + if (message.allowedCaCerts != null && message.allowedCaCerts.length) + for (var i = 0; i < message.allowedCaCerts.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.allowedCaCerts[i]); return writer; }; @@ -60024,6 +60539,11 @@ } message.requestHeaders[key] = value; break; + case 5: + if (!(message.allowedCaCerts && message.allowedCaCerts.length)) + message.allowedCaCerts = []; + message.allowedCaCerts.push(reader.bytes()); + break; default: reader.skipType(tag & 7); break; @@ -60076,6 +60596,13 @@ if (!$util.isString(message.requestHeaders[key[i]])) return "requestHeaders: string{k:string} expected"; } + if (message.allowedCaCerts != null && message.hasOwnProperty("allowedCaCerts")) { + if (!Array.isArray(message.allowedCaCerts)) + return "allowedCaCerts: array expected"; + for (var i = 0; i < message.allowedCaCerts.length; ++i) + if (!(message.allowedCaCerts[i] && typeof message.allowedCaCerts[i].length === "number" || $util.isString(message.allowedCaCerts[i]))) + return "allowedCaCerts: buffer[] expected"; + } return null; }; @@ -60104,6 +60631,16 @@ for (var keys = Object.keys(object.requestHeaders), i = 0; i < keys.length; ++i) message.requestHeaders[keys[i]] = String(object.requestHeaders[keys[i]]); } + if (object.allowedCaCerts) { + if (!Array.isArray(object.allowedCaCerts)) + throw TypeError(".google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.allowedCaCerts: array expected"); + message.allowedCaCerts = []; + for (var i = 0; i < object.allowedCaCerts.length; ++i) + if (typeof object.allowedCaCerts[i] === "string") + $util.base64.decode(object.allowedCaCerts[i], message.allowedCaCerts[i] = $util.newBuffer($util.base64.length(object.allowedCaCerts[i])), 0); + else if (object.allowedCaCerts[i].length) + message.allowedCaCerts[i] = object.allowedCaCerts[i]; + } return message; }; @@ -60120,6 +60657,8 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.allowedCaCerts = []; if (options.objects || options.defaults) object.requestHeaders = {}; if (options.defaults) { @@ -60139,6 +60678,11 @@ for (var j = 0; j < keys2.length; ++j) object.requestHeaders[keys2[j]] = message.requestHeaders[keys2[j]]; } + if (message.allowedCaCerts && message.allowedCaCerts.length) { + object.allowedCaCerts = []; + for (var j = 0; j < message.allowedCaCerts.length; ++j) + object.allowedCaCerts[j] = options.bytes === String ? $util.base64.encode(message.allowedCaCerts[j], 0, message.allowedCaCerts[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.allowedCaCerts[j]) : message.allowedCaCerts[j]; + } return object; }; diff --git a/protos/protos.json b/protos/protos.json index 0870a37b..e44fee97 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -2155,18 +2155,6 @@ } } }, - "AudioEncoding": { - "values": { - "AUDIO_ENCODING_UNSPECIFIED": 0, - "AUDIO_ENCODING_LINEAR_16": 1, - "AUDIO_ENCODING_FLAC": 2, - "AUDIO_ENCODING_MULAW": 3, - "AUDIO_ENCODING_AMR": 4, - "AUDIO_ENCODING_AMR_WB": 5, - "AUDIO_ENCODING_OGG_OPUS": 6, - "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 - } - }, "SpeechWordInfo": { "fields": { "word": { @@ -2187,6 +2175,18 @@ } } }, + "AudioEncoding": { + "values": { + "AUDIO_ENCODING_UNSPECIFIED": 0, + "AUDIO_ENCODING_LINEAR_16": 1, + "AUDIO_ENCODING_FLAC": 2, + "AUDIO_ENCODING_MULAW": 3, + "AUDIO_ENCODING_AMR": 4, + "AUDIO_ENCODING_AMR_WB": 5, + "AUDIO_ENCODING_OGG_OPUS": 6, + "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 + } + }, "InputAudioConfig": { "fields": { "audioEncoding": { @@ -6645,6 +6645,26 @@ } } ] + }, + "CompareVersions": { + "requestType": "CompareVersionsRequest", + "responseType": "CompareVersionsResponse", + "options": { + "(google.api.http).post": "/v3/{base_version=projects/*/locations/*/agents/*/flows/*/versions/*}:compareVersions", + "(google.api.http).body": "*", + "(google.api.method_signature)": "base_version" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{base_version=projects/*/locations/*/agents/*/flows/*/versions/*}:compareVersions", + "body": "*" + } + }, + { + "(google.api.method_signature)": "base_version" + } + ] } } }, @@ -6823,6 +6843,46 @@ } } }, + "CompareVersionsRequest": { + "fields": { + "baseVersion": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + }, + "targetVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "CompareVersionsResponse": { + "fields": { + "baseVersionContentJson": { + "type": "string", + "id": 1 + }, + "targetVersionContentJson": { + "type": "string", + "id": 2 + }, + "compareTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, "Webhooks": { "options": { "(google.api.default_host)": "dialogflow.googleapis.com", @@ -6995,6 +7055,14 @@ "keyType": "string", "type": "string", "id": 4 + }, + "allowedCaCerts": { + "rule": "repeated", + "type": "bytes", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, diff --git a/samples/generated/v3/versions.compare_versions.js b/samples/generated/v3/versions.compare_versions.js new file mode 100644 index 00000000..d6ad886d --- /dev/null +++ b/samples/generated/v3/versions.compare_versions.js @@ -0,0 +1,72 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(baseVersion, targetVersion) { + // [START dialogflow_v3_generated_Versions_CompareVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * Format: + * `projects//locations//agents//flows//versions/`. + */ + // const baseVersion = 'abc123' + /** + * Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: + * `projects//locations//agents//flows//versions/`. + */ + // const targetVersion = 'abc123' + /** + * The language to compare the flow versions for. + * If not specified, the agent's default language is used. + * Many + * languages (https://cloud.google.com/dialogflow/docs/reference/language) are + * supported. Note: languages must be enabled in the agent before they can be + * used. + */ + // const languageCode = 'abc123' + + // Imports the Cx library + const {VersionsClient} = require('@google-cloud/dialogflow-cx').v3; + + // Instantiates a client + const cxClient = new VersionsClient(); + + async function callCompareVersions() { + // Construct request + const request = { + baseVersion, + targetVersion, + }; + + // Run request + const response = await cxClient.compareVersions(request); + console.log(response); + } + + callCompareVersions(); + // [END dialogflow_v3_generated_Versions_CompareVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v3/versions.create_version.js b/samples/generated/v3/versions.create_version.js index 6e4b03fd..f4c1e039 100644 --- a/samples/generated/v3/versions.create_version.js +++ b/samples/generated/v3/versions.create_version.js @@ -20,9 +20,9 @@ function main(parent, version) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The Flow google.cloud.dialogflow.cx.v3.Flow to create an Version google.cloud.dialogflow.cx.v3.Version for. - * Format: `projects//locations//agents//flows/`. + * Required. The Flow google.cloud.dialogflow.cx.v3.Flow to create an + * Version google.cloud.dialogflow.cx.v3.Version for. Format: + * `projects//locations//agents//flows/`. */ // const parent = 'abc123' /** diff --git a/samples/generated/v3/versions.delete_version.js b/samples/generated/v3/versions.delete_version.js index 04e22508..683cacca 100644 --- a/samples/generated/v3/versions.delete_version.js +++ b/samples/generated/v3/versions.delete_version.js @@ -20,9 +20,9 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The name of the Version google.cloud.dialogflow.cx.v3.Version to delete. - * Format: `projects//locations//agents//flows//versions/`. + * Required. The name of the Version google.cloud.dialogflow.cx.v3.Version + * to delete. Format: + * `projects//locations//agents//flows//versions/`. */ // const name = 'abc123' diff --git a/samples/generated/v3/versions.get_version.js b/samples/generated/v3/versions.get_version.js index 2afa6cfb..67d8b4c5 100644 --- a/samples/generated/v3/versions.get_version.js +++ b/samples/generated/v3/versions.get_version.js @@ -21,8 +21,8 @@ function main(name) { */ /** * Required. The name of the Version google.cloud.dialogflow.cx.v3.Version. - * Format: `projects//locations//agents//flows//versions/`. + * Format: + * `projects//locations//agents//flows//versions/`. */ // const name = 'abc123' diff --git a/samples/generated/v3/versions.list_versions.js b/samples/generated/v3/versions.list_versions.js index 54553d10..0b76a1e2 100644 --- a/samples/generated/v3/versions.list_versions.js +++ b/samples/generated/v3/versions.list_versions.js @@ -20,9 +20,9 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The Flow google.cloud.dialogflow.cx.v3.Flow to list all versions for. - * Format: `projects//locations//agents//flows/`. + * Required. The Flow google.cloud.dialogflow.cx.v3.Flow to list all + * versions for. Format: + * `projects//locations//agents//flows/`. */ // const parent = 'abc123' /** diff --git a/samples/generated/v3/versions.load_version.js b/samples/generated/v3/versions.load_version.js index 6f0e434d..4da33998 100644 --- a/samples/generated/v3/versions.load_version.js +++ b/samples/generated/v3/versions.load_version.js @@ -20,9 +20,9 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The Version google.cloud.dialogflow.cx.v3.Version to be loaded to draft flow. - * Format: `projects//locations//agents//flows//versions/`. + * Required. The Version google.cloud.dialogflow.cx.v3.Version to be loaded + * to draft flow. Format: + * `projects//locations//agents//flows//versions/`. */ // const name = 'abc123' /** diff --git a/samples/generated/v3/versions.update_version.js b/samples/generated/v3/versions.update_version.js index f891f78e..352aa1f8 100644 --- a/samples/generated/v3/versions.update_version.js +++ b/samples/generated/v3/versions.update_version.js @@ -24,8 +24,8 @@ function main(version, updateMask) { */ // const version = {} /** - * Required. The mask to control which fields get updated. Currently only `description` - * and `display_name` can be updated. + * Required. The mask to control which fields get updated. Currently only + * `description` and `display_name` can be updated. */ // const updateMask = {} diff --git a/samples/generated/v3/webhooks.delete_webhook.js b/samples/generated/v3/webhooks.delete_webhook.js index 8a20ce89..4ea903c9 100644 --- a/samples/generated/v3/webhooks.delete_webhook.js +++ b/samples/generated/v3/webhooks.delete_webhook.js @@ -31,9 +31,10 @@ function main(name) { * * 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.v3.Fulfillment.webhook - * and tag google.cloud.dialogflow.cx.v3.Fulfillment.tag in fulfillments that point to this webhook - * will be removed). + * as any references to the webhook (i.e. + * Webhook google.cloud.dialogflow.cx.v3.Fulfillment.webhook and + * tag google.cloud.dialogflow.cx.v3.Fulfillment.tag in fulfillments that + * point to this webhook will be removed). */ // const force = true diff --git a/src/v3/gapic_metadata.json b/src/v3/gapic_metadata.json index 0b7ae65b..ae49fd37 100644 --- a/src/v3/gapic_metadata.json +++ b/src/v3/gapic_metadata.json @@ -1130,6 +1130,11 @@ "deleteVersion" ] }, + "CompareVersions": { + "methods": [ + "compareVersions" + ] + }, "CreateVersion": { "methods": [ "createVersion" @@ -1167,6 +1172,11 @@ "deleteVersion" ] }, + "CompareVersions": { + "methods": [ + "compareVersions" + ] + }, "CreateVersion": { "methods": [ "createVersion" diff --git a/src/v3/versions_client.ts b/src/v3/versions_client.ts index 759914f0..af445317 100644 --- a/src/v3/versions_client.ts +++ b/src/v3/versions_client.ts @@ -341,6 +341,7 @@ export class VersionsClient { 'updateVersion', 'deleteVersion', 'loadVersion', + 'compareVersions', ]; for (const methodName of versionsStubMethods) { const callPromise = this.versionsStub.then( @@ -436,8 +437,8 @@ export class VersionsClient { * The request object that will be sent. * @param {string} request.name * Required. The name of the {@link google.cloud.dialogflow.cx.v3.Version|Version}. - * Format: `projects//locations//agents//flows//versions/`. + * 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. @@ -530,8 +531,8 @@ export class VersionsClient { * @param {google.cloud.dialogflow.cx.v3.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. + * 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. @@ -622,9 +623,9 @@ export class VersionsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The name of the {@link google.cloud.dialogflow.cx.v3.Version|Version} to delete. - * Format: `projects//locations//agents//flows//versions/`. + * Required. The name of the {@link google.cloud.dialogflow.cx.v3.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. @@ -709,23 +710,133 @@ export class VersionsClient { this.initialize(); return this.innerApiCalls.deleteVersion(request, options, callback); } + /** + * Compares the specified base version with target version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.baseVersion + * Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * + * Format: + * `projects//locations//agents//flows//versions/`. + * @param {string} request.targetVersion + * Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: + * `projects//locations//agents//flows//versions/`. + * @param {string} request.languageCode + * The language to compare the flow versions for. + * + * 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 [CompareVersionsResponse]{@link google.cloud.dialogflow.cx.v3.CompareVersionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v3/versions.compare_versions.js + * region_tag:dialogflow_v3_generated_Versions_CompareVersions_async + */ + compareVersions( + request?: protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest | undefined, + {} | undefined + ] + >; + compareVersions( + request: protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, + | protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + compareVersions( + request: protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, + callback: Callback< + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, + | protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + compareVersions( + request?: protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, + | protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, + | protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse, + protos.google.cloud.dialogflow.cx.v3.ICompareVersionsRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + base_version: request.baseVersion || '', + }); + this.initialize(); + return this.innerApiCalls.compareVersions(request, options, callback); + } /** - * Creates a {@link google.cloud.dialogflow.cx.v3.Version|Version} in the specified {@link google.cloud.dialogflow.cx.v3.Flow|Flow}. + * Creates a {@link google.cloud.dialogflow.cx.v3.Version|Version} in the specified + * {@link google.cloud.dialogflow.cx.v3.Flow|Flow}. * * This method is a [long-running * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). * The returned `Operation` type has the following method-specific fields: * - * - `metadata`: {@link google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata|CreateVersionOperationMetadata} + * - `metadata`: + * {@link google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata|CreateVersionOperationMetadata} * - `response`: {@link google.cloud.dialogflow.cx.v3.Version|Version} * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The {@link google.cloud.dialogflow.cx.v3.Flow|Flow} to create an {@link google.cloud.dialogflow.cx.v3.Version|Version} for. - * Format: `projects//locations//agents//flows/`. + * Required. The {@link google.cloud.dialogflow.cx.v3.Flow|Flow} to create an + * {@link google.cloud.dialogflow.cx.v3.Version|Version} for. Format: + * `projects//locations//agents//flows/`. * @param {google.cloud.dialogflow.cx.v3.Version} request.version * Required. The version to create. * @param {object} [options] @@ -873,9 +984,9 @@ export class VersionsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The {@link google.cloud.dialogflow.cx.v3.Version|Version} to be loaded to draft flow. - * Format: `projects//locations//agents//flows//versions/`. + * Required. The {@link google.cloud.dialogflow.cx.v3.Version|Version} to be loaded + * to draft flow. Format: + * `projects//locations//agents//flows//versions/`. * @param {boolean} request.allowOverrideAgentResources * This field is used to prevent accidental overwrite of other agent * resources, which can potentially impact other flow's behavior. If @@ -1009,14 +1120,15 @@ export class VersionsClient { >; } /** - * Returns the list of all versions in the specified {@link google.cloud.dialogflow.cx.v3.Flow|Flow}. + * Returns the list of all versions in the specified + * {@link google.cloud.dialogflow.cx.v3.Flow|Flow}. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The {@link google.cloud.dialogflow.cx.v3.Flow|Flow} to list all versions for. - * Format: `projects//locations//agents//flows/`. + * Required. The {@link google.cloud.dialogflow.cx.v3.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. @@ -1115,9 +1227,9 @@ export class VersionsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The {@link google.cloud.dialogflow.cx.v3.Flow|Flow} to list all versions for. - * Format: `projects//locations//agents//flows/`. + * Required. The {@link google.cloud.dialogflow.cx.v3.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. @@ -1164,9 +1276,9 @@ export class VersionsClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The {@link google.cloud.dialogflow.cx.v3.Flow|Flow} to list all versions for. - * Format: `projects//locations//agents//flows/`. + * Required. The {@link google.cloud.dialogflow.cx.v3.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. diff --git a/src/v3/versions_client_config.json b/src/v3/versions_client_config.json index d0f8327c..a66a4544 100644 --- a/src/v3/versions_client_config.json +++ b/src/v3/versions_client_config.json @@ -52,6 +52,11 @@ "timeout_millis": 60000, "retry_codes_name": "unavailable", "retry_params_name": "default" + }, + "CompareVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" } } } diff --git a/src/v3/webhooks_client.ts b/src/v3/webhooks_client.ts index da96b811..15a847e7 100644 --- a/src/v3/webhooks_client.ts +++ b/src/v3/webhooks_client.ts @@ -689,9 +689,10 @@ export class WebhooksClient { * * 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.v3.Fulfillment.webhook|Webhook} - * and {@link google.cloud.dialogflow.cx.v3.Fulfillment.tag|tag}in fulfillments that point to this webhook - * will be removed). + * as any references to the webhook (i.e. + * {@link google.cloud.dialogflow.cx.v3.Fulfillment.webhook|Webhook} and + * {@link google.cloud.dialogflow.cx.v3.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. diff --git a/test/gapic_versions_v3.ts b/test/gapic_versions_v3.ts index c79dadcf..5fd903df 100644 --- a/test/gapic_versions_v3.ts +++ b/test/gapic_versions_v3.ts @@ -561,6 +561,117 @@ describe('v3.VersionsClient', () => { }); }); + describe('compareVersions', () => { + it('invokes compareVersions without error', async () => { + const client = new versionsModule.v3.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3.CompareVersionsRequest() + ); + request.baseVersion = ''; + const expectedHeaderRequestParams = 'base_version='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3.CompareVersionsResponse() + ); + client.innerApiCalls.compareVersions = stubSimpleCall(expectedResponse); + const [response] = await client.compareVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.compareVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes compareVersions without error using callback', async () => { + const client = new versionsModule.v3.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3.CompareVersionsRequest() + ); + request.baseVersion = ''; + const expectedHeaderRequestParams = 'base_version='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3.CompareVersionsResponse() + ); + client.innerApiCalls.compareVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.compareVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.cx.v3.ICompareVersionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.compareVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes compareVersions with error', async () => { + const client = new versionsModule.v3.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.cx.v3.CompareVersionsRequest() + ); + request.baseVersion = ''; + const expectedHeaderRequestParams = 'base_version='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.compareVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.compareVersions(request), expectedError); + assert( + (client.innerApiCalls.compareVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('createVersion', () => { it('invokes createVersion without error', async () => { const client = new versionsModule.v3.VersionsClient({