From 35a77f432d7d12dfe3e56370e2205ca37dd89a7d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Dec 2021 21:26:45 +0000 Subject: [PATCH] feat: added export documentation method feat: added filter in list documentations request feat: added option to import custom metadata from Google Cloud Storage in reload document request feat: added option to apply partial update to the smart messaging feat: removed OPTIONAL for speech model variant feat: supported the knowledge base in knowledge operation metadata docs: added more docs for speech model variant and improved docs format for participant PiperOrigin-RevId: 417030293 PiperOrigin-RevId: 416079874 Source-Link: https://github.com/googleapis/googleapis/commit/ebef8e6c5ad95fcaa306935565086bed4ffbf663 Source-Link: https://github.com/googleapis/googleapis-gen/commit/13951268b009d98d82355ccd9647f4350590609d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTM5NTEyNjhiMDA5ZDk4ZDgyMzU1Y2NkOTY0N2Y0MzUwNTkwNjA5ZCJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../cloud/dialogflow/v2/audio_config.proto | 60 +- .../google/cloud/dialogflow/v2/document.proto | 83 +++ protos/google/cloud/dialogflow/v2/gcs.proto | 10 + .../cloud/dialogflow/v2/knowledge_base.proto | 28 + .../cloud/dialogflow/v2/participant.proto | 1 + .../google/cloud/dialogflow/v2/session.proto | 1 + .../dialogflow/v2beta1/audio_config.proto | 9 +- .../v2beta1/conversation_profile.proto | 1 + .../cloud/dialogflow/v2beta1/document.proto | 3 + .../dialogflow/v2beta1/participant.proto | 281 +++----- protos/protos.d.ts | 276 +++++++- protos/protos.js | 667 +++++++++++++++++- protos/protos.json | 124 +++- .../generated/v2/documents.export_document.js | 70 ++ .../generated/v2/documents.list_documents.js | 18 + .../generated/v2/documents.reload_document.js | 10 + .../knowledge_bases.list_knowledge_bases.js | 22 + .../v2beta1/participants.suggest_articles.js | 5 +- src/v2/documents_client.ts | 239 +++++++ src/v2/documents_client_config.json | 5 + src/v2/gapic_metadata.json | 10 + src/v2/knowledge_bases_client.ts | 81 +++ src/v2beta1/participants_client.ts | 38 +- test/gapic_documents_v2.ts | 194 +++++ 24 files changed, 1948 insertions(+), 288 deletions(-) create mode 100644 samples/generated/v2/documents.export_document.js diff --git a/protos/google/cloud/dialogflow/v2/audio_config.proto b/protos/google/cloud/dialogflow/v2/audio_config.proto index 12931416..3fcae610 100644 --- a/protos/google/cloud/dialogflow/v2/audio_config.proto +++ b/protos/google/cloud/dialogflow/v2/audio_config.proto @@ -30,36 +30,6 @@ option java_outer_classname = "AudioConfigProto"; option java_package = "com.google.cloud.dialogflow.v2"; option objc_class_prefix = "DF"; -// Hints for the speech recognizer to help with recognition in a specific -// conversation state. -message SpeechContext { - // Optional. A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // This list can be used to: - // - // * improve accuracy for words and phrases you expect the user to say, - // e.g. typical commands for your Dialogflow agent - // * add additional words to the speech recognizer vocabulary - // * ... - // - // See the [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/quotas) for usage - // limits. - repeated string phrases = 1; - - // Optional. Boost for this context compared to other contexts: - // - // * If the boost is positive, Dialogflow will increase the probability that - // the phrases in this context are recognized over similar sounding phrases. - // * If the boost is unspecified or non-positive, Dialogflow will not apply - // any boost. - // - // Dialogflow recommends that you use boosts in the range (0, 20] and that you - // find a value that fits your use case with binary search. - float boost = 2; -} - // Audio encoding of the audio content sent in the conversational query request. // Refer to the // [Cloud Speech API @@ -109,6 +79,36 @@ enum AudioEncoding { AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; } +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + // Information for a word recognized by the speech recognizer. message SpeechWordInfo { // The word this info is for. diff --git a/protos/google/cloud/dialogflow/v2/document.proto b/protos/google/cloud/dialogflow/v2/document.proto index 11b9268b..25a58a43 100644 --- a/protos/google/cloud/dialogflow/v2/document.proto +++ b/protos/google/cloud/dialogflow/v2/document.proto @@ -20,6 +20,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/gcs.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -183,6 +184,30 @@ service Documents { metadata_type: "KnowledgeOperationMetadata" }; } + + // Exports a smart messaging candidate document into the specified + // destination. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + rpc ExportDocument(ExportDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } } // A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase]. @@ -328,6 +353,29 @@ message ListDocumentsRequest { // The next_page_token value returned from a previous list request. string page_token = 3; + + // The filter expression used to filter documents returned by the list method. + // The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * knowledge_types with has(:) operator + // * display_name with has(:) operator + // * state with equals(=) operator + // + // Examples: + // + // * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + // * "display_name:customer" matches documents whose display name contains + // "customer". + // * "state=ACTIVE" matches documents with ACTIVE state. + // * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; } // Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. @@ -403,6 +451,41 @@ message ReloadDocumentRequest { // the form `gs:///`. string content_uri = 3 [(google.api.field_behavior) = OPTIONAL]; } + + // Optional. Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When enabled, the reload request is to apply partial update to the smart + // messaging allowlist. + bool smart_messaging_partial_update = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument]. +message ExportDocumentRequest { + // Required. The name of the document to export. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The destination for the export. + oneof destination { + // Cloud Storage file path to export the document. + GcsDestination gcs_destination = 2; + } + + // When enabled, export the full content of the document including empirical + // probability. + bool export_full_content = 3; + + // When enabled, export the smart messaging allowlist document for partial + // update. + bool smart_messaging_partial_update = 5; } // Metadata in google::longrunning::Operation for Knowledge operations. diff --git a/protos/google/cloud/dialogflow/v2/gcs.proto b/protos/google/cloud/dialogflow/v2/gcs.proto index 1fb2dc99..9d96103e 100644 --- a/protos/google/cloud/dialogflow/v2/gcs.proto +++ b/protos/google/cloud/dialogflow/v2/gcs.proto @@ -26,3 +26,13 @@ option java_multiple_files = true; option java_outer_classname = "GcsProto"; option java_package = "com.google.cloud.dialogflow.v2"; option objc_class_prefix = "DF"; + +// Google Cloud Storage location for the output. +message GcsDestination { + // The Google Cloud Storage URIs for the output. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. The requesting + // user must have "write-permission" to the bucket. + string uri = 1; +} diff --git a/protos/google/cloud/dialogflow/v2/knowledge_base.proto b/protos/google/cloud/dialogflow/v2/knowledge_base.proto index 0b1aa8b3..14647757 100644 --- a/protos/google/cloud/dialogflow/v2/knowledge_base.proto +++ b/protos/google/cloud/dialogflow/v2/knowledge_base.proto @@ -165,6 +165,34 @@ message ListKnowledgeBasesRequest { // The next_page_token value returned from a previous list request. string page_token = 3; + + // The filter expression used to filter knowledge bases returned by the list + // method. The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * display_name with has(:) operator + // * language_code with equals(=) operator + // + // Examples: + // + // * 'language_code=en-us' matches knowledge bases with en-us language code. + // * 'display_name:articles' matches knowledge bases whose display name + // contains "articles". + // * 'display_name:"Best Articles"' matches knowledge bases whose display + // name contains "Best Articles". + // * 'language_code=en-gb AND display_name=articles' matches all knowledge + // bases whose display name contains "articles" and whose language code is + // "en-gb". + // + // Note: An empty filter string (i.e. "") is a no-op and will result in no + // filtering. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; } // Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. diff --git a/protos/google/cloud/dialogflow/v2/participant.proto b/protos/google/cloud/dialogflow/v2/participant.proto index cc67584f..71bc3a96 100644 --- a/protos/google/cloud/dialogflow/v2/participant.proto +++ b/protos/google/cloud/dialogflow/v2/participant.proto @@ -21,6 +21,7 @@ import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/gcs.proto"; import "google/cloud/dialogflow/v2/session.proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; diff --git a/protos/google/cloud/dialogflow/v2/session.proto b/protos/google/cloud/dialogflow/v2/session.proto index 7f833221..6c4bf790 100644 --- a/protos/google/cloud/dialogflow/v2/session.proto +++ b/protos/google/cloud/dialogflow/v2/session.proto @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/dialogflow/v2/audio_config.proto"; import "google/cloud/dialogflow/v2/context.proto"; +import "google/cloud/dialogflow/v2/gcs.proto"; import "google/cloud/dialogflow/v2/intent.proto"; import "google/cloud/dialogflow/v2/session_entity_type.proto"; import "google/protobuf/duration.proto"; diff --git a/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/protos/google/cloud/dialogflow/v2beta1/audio_config.proto index 11eab2d2..1c19b4b0 100644 --- a/protos/google/cloud/dialogflow/v2beta1/audio_config.proto +++ b/protos/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -373,13 +373,16 @@ enum OutputAudioEncoding { OUTPUT_AUDIO_ENCODING_MULAW = 5; } -// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. +// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. message SpeechToTextConfig { - // Optional. The speech model used in speech to text. + // The speech model used in speech to text. // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as // `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest] and // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest] request. - SpeechModelVariant speech_model_variant = 1 [(google.api.field_behavior) = OPTIONAL]; + // If enhanced model variant is specified and an enhanced + // version of the specified model for the language does not exist, then it + // would emit an error. + SpeechModelVariant speech_model_variant = 1; } // [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) diff --git a/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto index 32235634..e6fef0d9 100644 --- a/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto +++ b/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto @@ -24,6 +24,7 @@ import "google/cloud/dialogflow/v2beta1/audio_config.proto"; import "google/cloud/dialogflow/v2beta1/document.proto"; import "google/cloud/dialogflow/v2beta1/participant.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; diff --git a/protos/google/cloud/dialogflow/v2beta1/document.proto b/protos/google/cloud/dialogflow/v2beta1/document.proto index d6947467..c8751e6b 100644 --- a/protos/google/cloud/dialogflow/v2beta1/document.proto +++ b/protos/google/cloud/dialogflow/v2beta1/document.proto @@ -540,6 +540,9 @@ message KnowledgeOperationMetadata { // Required. Output only. The current state of this operation. State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the knowledge base interacted with during the operation. + string knowledge_base = 3; } // Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. diff --git a/protos/google/cloud/dialogflow/v2beta1/participant.proto b/protos/google/cloud/dialogflow/v2beta1/participant.proto index e42fbd03..b53c8b26 100644 --- a/protos/google/cloud/dialogflow/v2beta1/participant.proto +++ b/protos/google/cloud/dialogflow/v2beta1/participant.proto @@ -38,8 +38,7 @@ option java_outer_classname = "ParticipantProto"; option java_package = "com.google.cloud.dialogflow.v2beta1"; option objc_class_prefix = "DF"; -// Service for managing -// [Participants][google.cloud.dialogflow.v2beta1.Participant]. +// Service for managing [Participants][google.cloud.dialogflow.v2beta1.Participant]. service Participants { option (google.api.default_host) = "dialogflow.googleapis.com"; option (google.api.oauth_scopes) = @@ -71,8 +70,7 @@ service Participants { } // Returns the list of all participants in the specified conversation. - rpc ListParticipants(ListParticipantsRequest) - returns (ListParticipantsResponse) { + rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { option (google.api.http) = { get: "/v2beta1/{parent=projects/*/conversations/*}/participants" additional_bindings { @@ -117,14 +115,10 @@ service Participants { // Gets suggested articles for a participant based on specific historical // messages. // - // Note that - // [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] - // will only list the auto-generated suggestions, while - // [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] - // will try to compile suggestion based on the provided conversation context - // in the real time. - rpc SuggestArticles(SuggestArticlesRequest) - returns (SuggestArticlesResponse) { + // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated + // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion + // based on the provided conversation context in the real time. + rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { option (google.api.http) = { post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" body: "*" @@ -138,8 +132,7 @@ service Participants { // Gets suggested faq answers for a participant based on specific historical // messages. - rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) - returns (SuggestFaqAnswersResponse) { + rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { option (google.api.http) = { post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" body: "*" @@ -153,8 +146,7 @@ service Participants { // Gets smart replies for a participant based on specific historical // messages. - rpc SuggestSmartReplies(SuggestSmartRepliesRequest) - returns (SuggestSmartRepliesResponse) { + rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { option (google.api.http) = { post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" body: "*" @@ -168,9 +160,9 @@ service Participants { // Deprecated: Use inline suggestion, event based suggestion or // Suggestion* API instead. - // See - // [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] - // for more details. Removal Date: 2020-09-01. + // See [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more + // details. + // Removal Date: 2020-09-01. // // Retrieves suggestions for live agents. // @@ -186,31 +178,22 @@ service Participants { // To fetch new suggestions without duplication, send request with filter // `create_time_epoch_microseconds > [first item's create_time of previous // request]` and empty page_token. - rpc ListSuggestions(ListSuggestionsRequest) - returns (ListSuggestionsResponse) { + rpc ListSuggestions(ListSuggestionsRequest) returns (ListSuggestionsResponse) { option deprecated = true; option (google.api.http) = { get: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions" }; } - // Deprecated. use - // [SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles] - // and - // [SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers] - // instead. + // Deprecated. use [SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles] and [SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers] instead. // // Gets suggestions for a participant based on specific historical // messages. // - // Note that - // [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] - // will only list the auto-generated suggestions, while - // [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] - // will try to compile suggestion based on the provided conversation context - // in the real time. - rpc CompileSuggestion(CompileSuggestionRequest) - returns (CompileSuggestionResponse) { + // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated + // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion + // based on the provided conversation context in the real time. + rpc CompileSuggestion(CompileSuggestionRequest) returns (CompileSuggestionResponse) { option deprecated = true; option (google.api.http) = { post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:compile" @@ -248,27 +231,23 @@ message Participant { // ID>/conversations//participants/`. string name = 1 [(google.api.field_behavior) = OPTIONAL]; - // Immutable. The role this participant plays in the conversation. This field - // must be set during participant creation and is then immutable. + // Immutable. The role this participant plays in the conversation. This field must be set + // during participant creation and is then immutable. Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; - // Optional. Obfuscated user id that should be associated with the created - // participant. + // Optional. Obfuscated user id that should be associated with the created participant. // // You can specify a user id as follows: // // 1. If you set this field in - // [CreateParticipantRequest][google.cloud.dialogflow.v2beta1.CreateParticipantRequest.participant] - // or + // [CreateParticipantRequest][google.cloud.dialogflow.v2beta1.CreateParticipantRequest.participant] or // [UpdateParticipantRequest][google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.participant], // Dialogflow adds the obfuscated user id with the participant. // // 2. If you set this field in - // [AnalyzeContent][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.obfuscated_external_user_id] - // or + // [AnalyzeContent][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.obfuscated_external_user_id] or // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.obfuscated_external_user_id], - // Dialogflow will update - // [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2beta1.Participant.obfuscated_external_user_id]. + // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2beta1.Participant.obfuscated_external_user_id]. // // Dialogflow uses this user id for following purposes: // 1) Billing and measurement. If user with the same @@ -284,27 +263,25 @@ message Participant { // * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a // hash function like SHA-512. // * The length of the user id must be <= 256 characters. - string obfuscated_external_user_id = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Key-value filters on the metadata of documents returned by - // article suggestion. If specified, article suggestion only returns suggested - // documents that match all filters in their - // [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. - // Multiple values for a metadata key should be concatenated by comma. For - // example, filters to match all documents that have 'US' or 'CA' in their - // market metadata values and 'agent' in their user metadata values will be - // - // documents_metadata_filters { - // key: "market" - // value: "US,CA" - // } - // documents_metadata_filters { - // key: "user" - // value: "agent" - // } - map documents_metadata_filters = 8 - [(google.api.field_behavior) = OPTIONAL]; + string obfuscated_external_user_id = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 8 [(google.api.field_behavior) = OPTIONAL]; } // Represents a message posted into a conversation. @@ -332,28 +309,22 @@ message Message { string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The role of the participant. - Participant.Role participant_role = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; + Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The time when the message was created in Contact Center AI. - google.protobuf.Timestamp create_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; // Optional. The time when the message was sent. - google.protobuf.Timestamp send_time = 9 - [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.Timestamp send_time = 9 [(google.api.field_behavior) = OPTIONAL]; // Output only. The annotation for the message. - MessageAnnotation message_annotation = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; + MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The sentiment analysis result for the message. - SentimentAnalysisResult sentiment_analysis = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; + SentimentAnalysisResult sentiment_analysis = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } -// The request message for -// [Participants.CreateParticipant][google.cloud.dialogflow.v2beta1.Participants.CreateParticipant]. +// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2beta1.Participants.CreateParticipant]. message CreateParticipantRequest { // Required. Resource identifier of the conversation adding the participant. // Format: `projects//locations//locations//conversations//locations//locations/ // /agents//intents/`. string intent = 4 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Intent" - }]; + type: "dialogflow.googleapis.com/Intent" + }]; // Event name if an event is triggered for the query. string event = 5; @@ -531,25 +495,24 @@ message SuggestionFeature { message AssistQueryParameters { // Key-value filters on the metadata of documents returned by article // suggestion. If specified, article suggestion only returns suggested - // documents that match all filters in their - // [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. - // Multiple values for a metadata key should be concatenated by comma. For - // example, filters to match all documents that have 'US' or 'CA' in their - // market metadata values and 'agent' in their user metadata values will be - // - // documents_metadata_filters { - // key: "market" - // value: "US,CA" - // } - // documents_metadata_filters { - // key: "user" - // value: "agent" - // } + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` map documents_metadata_filters = 1; } -// The request message for -// [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. +// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. message AnalyzeContentRequest { // Required. The name of the participant this text comes from. // Format: `projects//locations//locations//locations//locations//locations//conversations//messages/`. string latest_message = 2 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Message" - }]; + type: "dialogflow.googleapis.com/Message" + }]; // Optional. Max number of messages prior to and including // [latest_message] to use as context when compiling the @@ -935,8 +879,7 @@ message SuggestSmartRepliesRequest { int32 context_size = 3; } -// The response message for -// [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. +// The response message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. message SuggestSmartRepliesResponse { // Output only. Multiple reply options provided by smart reply service. The // order is based on the rank of the model prediction. @@ -951,11 +894,10 @@ message SuggestSmartRepliesResponse { string latest_message = 2; // Number of messages prior to and including - // [latest_message][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.latest_message] - // to compile the suggestion. It may be smaller than the - // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.context_size] - // field in the request if there aren't that many messages in the - // conversation. + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.context_size] field in the request if there + // aren't that many messages in the conversation. int32 context_size = 3; } @@ -1035,8 +977,7 @@ message Suggestion { string latest_message = 7; } -// The request message for -// [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. +// The request message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. message ListSuggestionsRequest { option deprecated = true; @@ -1063,8 +1004,7 @@ message ListSuggestionsRequest { string filter = 4; } -// The response message for -// [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. +// The response message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. message ListSuggestionsResponse { option deprecated = true; @@ -1078,8 +1018,7 @@ message ListSuggestionsResponse { string next_page_token = 2; } -// The request message for -// [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. +// The request message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. message CompileSuggestionRequest { option deprecated = true; @@ -1101,8 +1040,7 @@ message CompileSuggestionRequest { int32 context_size = 3; } -// The response message for -// [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. +// The response message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. message CompileSuggestionResponse { option deprecated = true; @@ -1119,9 +1057,8 @@ message CompileSuggestionResponse { // Number of messages prior to and including // [latest_message][google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.latest_message] // to compile the suggestion. It may be smaller than the - // [CompileSuggestionRequest.context_size][google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.context_size] - // field in the request if there aren't that many messages in the - // conversation. + // [CompileSuggestionRequest.context_size][google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.context_size] field in the request if + // there aren't that many messages in the conversation. int32 context_size = 3; } @@ -1151,7 +1088,9 @@ message ResponseMessage { } // Indicates that interaction with the Dialogflow agent has ended. - message EndInteraction {} + message EndInteraction { + + } // Represents the signal that telles the client to transfer the phone call // connected to the agent to a third-party endpoint. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 860e8499..7689c001 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -5022,6 +5022,18 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + /** Properties of a SpeechContext. */ interface ISpeechContext { @@ -5118,18 +5130,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** AudioEncoding enum. */ - enum AudioEncoding { - AUDIO_ENCODING_UNSPECIFIED = 0, - AUDIO_ENCODING_LINEAR_16 = 1, - AUDIO_ENCODING_FLAC = 2, - AUDIO_ENCODING_MULAW = 3, - AUDIO_ENCODING_AMR = 4, - AUDIO_ENCODING_AMR_WB = 5, - AUDIO_ENCODING_OGG_OPUS = 6, - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 - } - /** Properties of a SpeechWordInfo. */ interface ISpeechWordInfo { @@ -5810,6 +5810,96 @@ export namespace google { OUTPUT_AUDIO_ENCODING_MULAW = 5 } + /** Properties of a GcsDestination. */ + interface IGcsDestination { + + /** GcsDestination uri */ + uri?: (string|null); + } + + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { + + /** + * Constructs a new GcsDestination. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGcsDestination); + + /** GcsDestination uri. */ + public uri: string; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsDestination instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGcsDestination): google.cloud.dialogflow.v2.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.dialogflow.v2.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsDestination + * @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.v2.GcsDestination; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsDestination + * @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.v2.GcsDestination; + + /** + * Verifies a GcsDestination 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 GcsDestination message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsDestination + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GcsDestination; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @param message GcsDestination + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsDestination to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents a Sessions */ class Sessions extends $protobuf.rpc.Service { @@ -19601,6 +19691,20 @@ export namespace google { * @returns Promise */ public reloadDocument(request: google.cloud.dialogflow.v2.IReloadDocumentRequest): Promise; + + /** + * Calls ExportDocument. + * @param request ExportDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportDocument(request: google.cloud.dialogflow.v2.IExportDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.ExportDocumentCallback): void; + + /** + * Calls ExportDocument. + * @param request ExportDocumentRequest message or plain object + * @returns Promise + */ + public exportDocument(request: google.cloud.dialogflow.v2.IExportDocumentRequest): Promise; } namespace Documents { @@ -19646,6 +19750,13 @@ export namespace google { * @param [response] Operation */ type ReloadDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents#exportDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } /** Properties of a Document. */ @@ -19997,6 +20108,9 @@ export namespace google { /** ListDocumentsRequest pageToken */ pageToken?: (string|null); + + /** ListDocumentsRequest filter */ + filter?: (string|null); } /** Represents a ListDocumentsRequest. */ @@ -20017,6 +20131,9 @@ export namespace google { /** ListDocumentsRequest pageToken. */ public pageToken: string; + /** ListDocumentsRequest filter. */ + public filter: string; + /** * Creates a new ListDocumentsRequest instance using the specified properties. * @param [properties] Properties to set @@ -20474,6 +20591,12 @@ export namespace google { /** ReloadDocumentRequest contentUri */ contentUri?: (string|null); + + /** ReloadDocumentRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); + + /** ReloadDocumentRequest smartMessagingPartialUpdate */ + smartMessagingPartialUpdate?: (boolean|null); } /** Represents a ReloadDocumentRequest. */ @@ -20491,6 +20614,12 @@ export namespace google { /** ReloadDocumentRequest contentUri. */ public contentUri?: (string|null); + /** ReloadDocumentRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + + /** ReloadDocumentRequest smartMessagingPartialUpdate. */ + public smartMessagingPartialUpdate: boolean; + /** ReloadDocumentRequest source. */ public source?: "contentUri"; @@ -20565,6 +20694,117 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of an ExportDocumentRequest. */ + interface IExportDocumentRequest { + + /** ExportDocumentRequest name */ + name?: (string|null); + + /** ExportDocumentRequest gcsDestination */ + gcsDestination?: (google.cloud.dialogflow.v2.IGcsDestination|null); + + /** ExportDocumentRequest exportFullContent */ + exportFullContent?: (boolean|null); + + /** ExportDocumentRequest smartMessagingPartialUpdate */ + smartMessagingPartialUpdate?: (boolean|null); + } + + /** Represents an ExportDocumentRequest. */ + class ExportDocumentRequest implements IExportDocumentRequest { + + /** + * Constructs a new ExportDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IExportDocumentRequest); + + /** ExportDocumentRequest name. */ + public name: string; + + /** ExportDocumentRequest gcsDestination. */ + public gcsDestination?: (google.cloud.dialogflow.v2.IGcsDestination|null); + + /** ExportDocumentRequest exportFullContent. */ + public exportFullContent: boolean; + + /** ExportDocumentRequest smartMessagingPartialUpdate. */ + public smartMessagingPartialUpdate: boolean; + + /** ExportDocumentRequest destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new ExportDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IExportDocumentRequest): google.cloud.dialogflow.v2.ExportDocumentRequest; + + /** + * Encodes the specified ExportDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @param message ExportDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IExportDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @param message ExportDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IExportDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportDocumentRequest + * @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.v2.ExportDocumentRequest; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportDocumentRequest + * @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.v2.ExportDocumentRequest; + + /** + * Verifies an ExportDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ExportDocumentRequest; + + /** + * Creates a plain object from an ExportDocumentRequest message. Also converts values to other types if specified. + * @param message ExportDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ExportDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a KnowledgeOperationMetadata. */ interface IKnowledgeOperationMetadata { @@ -22881,6 +23121,9 @@ export namespace google { /** ListKnowledgeBasesRequest pageToken */ pageToken?: (string|null); + + /** ListKnowledgeBasesRequest filter */ + filter?: (string|null); } /** Represents a ListKnowledgeBasesRequest. */ @@ -22901,6 +23144,9 @@ export namespace google { /** ListKnowledgeBasesRequest pageToken. */ public pageToken: string; + /** ListKnowledgeBasesRequest filter. */ + public filter: string; + /** * Creates a new ListKnowledgeBasesRequest instance using the specified properties. * @param [properties] Properties to set @@ -51562,6 +51808,9 @@ export namespace google { /** KnowledgeOperationMetadata state */ state?: (google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|null); + + /** KnowledgeOperationMetadata knowledgeBase */ + knowledgeBase?: (string|null); } /** Represents a KnowledgeOperationMetadata. */ @@ -51576,6 +51825,9 @@ export namespace google { /** KnowledgeOperationMetadata state. */ public state: (google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State); + /** KnowledgeOperationMetadata knowledgeBase. */ + public knowledgeBase: string; + /** * Creates a new KnowledgeOperationMetadata instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index 92e1bfb1..54c961c3 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -12058,6 +12058,32 @@ return AssistQueryParameters; })(); + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.v2.AudioEncoding + * @enum {number} + * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value + * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value + * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value + * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value + * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value + * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value + * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value + * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value + */ + v2.AudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; + values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; + values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; + values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; + values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; + values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; + return values; + })(); + v2.SpeechContext = (function() { /** @@ -12284,32 +12310,6 @@ return SpeechContext; })(); - /** - * AudioEncoding enum. - * @name google.cloud.dialogflow.v2.AudioEncoding - * @enum {number} - * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value - * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value - * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value - * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value - * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value - * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value - * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value - * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value - */ - v2.AudioEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; - values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; - values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; - values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; - values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; - values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; - values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; - return values; - })(); - v2.SpeechWordInfo = (function() { /** @@ -14134,6 +14134,193 @@ return values; })(); + v2.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.dialogflow.v2 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.dialogflow.v2.IGcsDestination=} [properties] Properties to set + */ + function GcsDestination(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]]; + } + + /** + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.dialogflow.v2.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.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.v2.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsDestination message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDestination.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + return null; + }; + + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GcsDestination) + return object; + var message = new $root.google.cloud.dialogflow.v2.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.GcsDestination} message GcsDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @instance + * @returns {Object.} JSON object + */ + GcsDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GcsDestination; + })(); + v2.Sessions = (function() { /** @@ -47106,6 +47293,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents#exportDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef ExportDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportDocument. + * @function exportDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} request ExportDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.ExportDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.exportDocument = function exportDocument(request, callback) { + return this.rpcCall(exportDocument, $root.google.cloud.dialogflow.v2.ExportDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportDocument" }); + + /** + * Calls ExportDocument. + * @function exportDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} request ExportDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return Documents; })(); @@ -48026,6 +48246,7 @@ * @property {string|null} [parent] ListDocumentsRequest parent * @property {number|null} [pageSize] ListDocumentsRequest pageSize * @property {string|null} [pageToken] ListDocumentsRequest pageToken + * @property {string|null} [filter] ListDocumentsRequest filter */ /** @@ -48067,6 +48288,14 @@ */ ListDocumentsRequest.prototype.pageToken = ""; + /** + * ListDocumentsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.filter = ""; + /** * Creates a new ListDocumentsRequest instance using the specified properties. * @function create @@ -48097,6 +48326,8 @@ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); return writer; }; @@ -48140,6 +48371,9 @@ case 3: message.pageToken = reader.string(); break; + case 4: + message.filter = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -48184,6 +48418,9 @@ if (message.pageToken != null && message.hasOwnProperty("pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; return null; }; @@ -48205,6 +48442,8 @@ message.pageSize = object.pageSize | 0; if (object.pageToken != null) message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); return message; }; @@ -48225,6 +48464,7 @@ object.parent = ""; object.pageSize = 0; object.pageToken = ""; + object.filter = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -48232,6 +48472,8 @@ object.pageSize = message.pageSize; if (message.pageToken != null && message.hasOwnProperty("pageToken")) object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; return object; }; @@ -49110,6 +49352,8 @@ * @interface IReloadDocumentRequest * @property {string|null} [name] ReloadDocumentRequest name * @property {string|null} [contentUri] ReloadDocumentRequest contentUri + * @property {boolean|null} [importGcsCustomMetadata] ReloadDocumentRequest importGcsCustomMetadata + * @property {boolean|null} [smartMessagingPartialUpdate] ReloadDocumentRequest smartMessagingPartialUpdate */ /** @@ -49143,6 +49387,22 @@ */ ReloadDocumentRequest.prototype.contentUri = null; + /** + * ReloadDocumentRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.importGcsCustomMetadata = false; + + /** + * ReloadDocumentRequest smartMessagingPartialUpdate. + * @member {boolean} smartMessagingPartialUpdate + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.smartMessagingPartialUpdate = false; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -49185,6 +49445,10 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); if (message.contentUri != null && Object.hasOwnProperty.call(message, "contentUri")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.contentUri); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.importGcsCustomMetadata); + if (message.smartMessagingPartialUpdate != null && Object.hasOwnProperty.call(message, "smartMessagingPartialUpdate")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.smartMessagingPartialUpdate); return writer; }; @@ -49225,6 +49489,12 @@ case 3: message.contentUri = reader.string(); break; + case 4: + message.importGcsCustomMetadata = reader.bool(); + break; + case 5: + message.smartMessagingPartialUpdate = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -49269,6 +49539,12 @@ if (!$util.isString(message.contentUri)) return "contentUri: string expected"; } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + if (typeof message.smartMessagingPartialUpdate !== "boolean") + return "smartMessagingPartialUpdate: boolean expected"; return null; }; @@ -49288,6 +49564,10 @@ message.name = String(object.name); if (object.contentUri != null) message.contentUri = String(object.contentUri); + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); + if (object.smartMessagingPartialUpdate != null) + message.smartMessagingPartialUpdate = Boolean(object.smartMessagingPartialUpdate); return message; }; @@ -49304,8 +49584,11 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.name = ""; + object.importGcsCustomMetadata = false; + object.smartMessagingPartialUpdate = false; + } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.contentUri != null && message.hasOwnProperty("contentUri")) { @@ -49313,6 +49596,10 @@ if (options.oneofs) object.source = "contentUri"; } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + object.smartMessagingPartialUpdate = message.smartMessagingPartialUpdate; return object; }; @@ -49330,6 +49617,285 @@ return ReloadDocumentRequest; })(); + v2.ExportDocumentRequest = (function() { + + /** + * Properties of an ExportDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IExportDocumentRequest + * @property {string|null} [name] ExportDocumentRequest name + * @property {google.cloud.dialogflow.v2.IGcsDestination|null} [gcsDestination] ExportDocumentRequest gcsDestination + * @property {boolean|null} [exportFullContent] ExportDocumentRequest exportFullContent + * @property {boolean|null} [smartMessagingPartialUpdate] ExportDocumentRequest smartMessagingPartialUpdate + */ + + /** + * Constructs a new ExportDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ExportDocumentRequest. + * @implements IExportDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest=} [properties] Properties to set + */ + function ExportDocumentRequest(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]]; + } + + /** + * ExportDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.name = ""; + + /** + * ExportDocumentRequest gcsDestination. + * @member {google.cloud.dialogflow.v2.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.gcsDestination = null; + + /** + * ExportDocumentRequest exportFullContent. + * @member {boolean} exportFullContent + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.exportFullContent = false; + + /** + * ExportDocumentRequest smartMessagingPartialUpdate. + * @member {boolean} smartMessagingPartialUpdate + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.smartMessagingPartialUpdate = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportDocumentRequest destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + Object.defineProperty(ExportDocumentRequest.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest instance + */ + ExportDocumentRequest.create = function create(properties) { + return new ExportDocumentRequest(properties); + }; + + /** + * Encodes the specified ExportDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} message ExportDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.dialogflow.v2.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.exportFullContent != null && Object.hasOwnProperty.call(message, "exportFullContent")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.exportFullContent); + if (message.smartMessagingPartialUpdate != null && Object.hasOwnProperty.call(message, "smartMessagingPartialUpdate")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.smartMessagingPartialUpdate); + return writer; + }; + + /** + * Encodes the specified ExportDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} message ExportDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentRequest.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.v2.ExportDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.gcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.decode(reader, reader.uint32()); + break; + case 3: + message.exportFullContent = reader.bool(); + break; + case 5: + message.smartMessagingPartialUpdate = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.dialogflow.v2.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.exportFullContent != null && message.hasOwnProperty("exportFullContent")) + if (typeof message.exportFullContent !== "boolean") + return "exportFullContent: boolean expected"; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + if (typeof message.smartMessagingPartialUpdate !== "boolean") + return "smartMessagingPartialUpdate: boolean expected"; + return null; + }; + + /** + * Creates an ExportDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest + */ + ExportDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ExportDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ExportDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ExportDocumentRequest.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.fromObject(object.gcsDestination); + } + if (object.exportFullContent != null) + message.exportFullContent = Boolean(object.exportFullContent); + if (object.smartMessagingPartialUpdate != null) + message.smartMessagingPartialUpdate = Boolean(object.smartMessagingPartialUpdate); + return message; + }; + + /** + * Creates a plain object from an ExportDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.ExportDocumentRequest} message ExportDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.exportFullContent = false; + object.smartMessagingPartialUpdate = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.exportFullContent != null && message.hasOwnProperty("exportFullContent")) + object.exportFullContent = message.exportFullContent; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + object.smartMessagingPartialUpdate = message.smartMessagingPartialUpdate; + return object; + }; + + /** + * Converts this ExportDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ExportDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExportDocumentRequest; + })(); + v2.KnowledgeOperationMetadata = (function() { /** @@ -54588,6 +55154,7 @@ * @property {string|null} [parent] ListKnowledgeBasesRequest parent * @property {number|null} [pageSize] ListKnowledgeBasesRequest pageSize * @property {string|null} [pageToken] ListKnowledgeBasesRequest pageToken + * @property {string|null} [filter] ListKnowledgeBasesRequest filter */ /** @@ -54629,6 +55196,14 @@ */ ListKnowledgeBasesRequest.prototype.pageToken = ""; + /** + * ListKnowledgeBasesRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.filter = ""; + /** * Creates a new ListKnowledgeBasesRequest instance using the specified properties. * @function create @@ -54659,6 +55234,8 @@ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); return writer; }; @@ -54702,6 +55279,9 @@ case 3: message.pageToken = reader.string(); break; + case 4: + message.filter = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -54746,6 +55326,9 @@ if (message.pageToken != null && message.hasOwnProperty("pageToken")) if (!$util.isString(message.pageToken)) return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; return null; }; @@ -54767,6 +55350,8 @@ message.pageSize = object.pageSize | 0; if (object.pageToken != null) message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); return message; }; @@ -54787,6 +55372,7 @@ object.parent = ""; object.pageSize = 0; object.pageToken = ""; + object.filter = ""; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -54794,6 +55380,8 @@ object.pageSize = message.pageSize; if (message.pageToken != null && message.hasOwnProperty("pageToken")) object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; return object; }; @@ -123523,6 +124111,7 @@ * @memberof google.cloud.dialogflow.v2beta1 * @interface IKnowledgeOperationMetadata * @property {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|null} [state] KnowledgeOperationMetadata state + * @property {string|null} [knowledgeBase] KnowledgeOperationMetadata knowledgeBase */ /** @@ -123548,6 +124137,14 @@ */ KnowledgeOperationMetadata.prototype.state = 0; + /** + * KnowledgeOperationMetadata knowledgeBase. + * @member {string} knowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.knowledgeBase = ""; + /** * Creates a new KnowledgeOperationMetadata instance using the specified properties. * @function create @@ -123574,6 +124171,8 @@ writer = $Writer.create(); if (message.state != null && Object.hasOwnProperty.call(message, "state")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.knowledgeBase); return writer; }; @@ -123611,6 +124210,9 @@ case 1: message.state = reader.int32(); break; + case 3: + message.knowledgeBase = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -123656,6 +124258,9 @@ case 3: break; } + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + if (!$util.isString(message.knowledgeBase)) + return "knowledgeBase: string expected"; return null; }; @@ -123689,6 +124294,8 @@ message.state = 3; break; } + if (object.knowledgeBase != null) + message.knowledgeBase = String(object.knowledgeBase); return message; }; @@ -123705,10 +124312,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.knowledgeBase = ""; + } if (message.state != null && message.hasOwnProperty("state")) object.state = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State[message.state] : message.state; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = message.knowledgeBase; return object; }; diff --git a/protos/protos.json b/protos/protos.json index f4e7a521..53d80ded 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -1605,6 +1605,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 + } + }, "SpeechContext": { "fields": { "phrases": { @@ -1618,18 +1630,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": { @@ -1789,6 +1789,14 @@ "OUTPUT_AUDIO_ENCODING_MULAW": 5 } }, + "GcsDestination": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, "Sessions": { "options": { "(google.api.default_host)": "dialogflow.googleapis.com", @@ -6242,6 +6250,36 @@ } } ] + }, + "ExportDocument": { + "requestType": "ExportDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export", + "body": "*", + "additional_bindings": { + "post": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] } } }, @@ -6371,6 +6409,10 @@ "pageToken": { "type": "string", "id": 3 + }, + "filter": { + "type": "string", + "id": 4 } } }, @@ -6459,6 +6501,51 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "smartMessagingPartialUpdate": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExportDocumentRequest": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "gcsDestination": { + "type": "GcsDestination", + "id": 2 + }, + "exportFullContent": { + "type": "bool", + "id": 3 + }, + "smartMessagingPartialUpdate": { + "type": "bool", + "id": 5 } } }, @@ -7299,6 +7386,10 @@ "pageToken": { "type": "string", "id": 3 + }, + "filter": { + "type": "string", + "id": 4 } } }, @@ -8892,10 +8983,7 @@ "fields": { "speechModelVariant": { "type": "SpeechModelVariant", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } + "id": 1 } } }, @@ -15538,6 +15626,10 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "knowledgeBase": { + "type": "string", + "id": 3 } }, "nested": { diff --git a/samples/generated/v2/documents.export_document.js b/samples/generated/v2/documents.export_document.js new file mode 100644 index 00000000..9c374d01 --- /dev/null +++ b/samples/generated/v2/documents.export_document.js @@ -0,0 +1,70 @@ +// 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(name) { + // [START dialogflow_v2_generated_Documents_ExportDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + /** + * Cloud Storage file path to export the document. + */ + // const gcsDestination = {} + /** + * When enabled, export the full content of the document including empirical + * probability. + */ + // const exportFullContent = true + /** + * When enabled, export the smart messaging allowlist document for partial + * update. + */ + // const smartMessagingPartialUpdate = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callExportDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.exportDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportDocument(); + // [END dialogflow_v2_generated_Documents_ExportDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/samples/generated/v2/documents.list_documents.js b/samples/generated/v2/documents.list_documents.js index d63833b8..c812570f 100644 --- a/samples/generated/v2/documents.list_documents.js +++ b/samples/generated/v2/documents.list_documents.js @@ -35,6 +35,24 @@ function main(parent) { * The next_page_token value returned from a previous list request. */ // const pageToken = 'abc123' + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * AND ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' // Imports the Dialogflow library const {DocumentsClient} = require('@google-cloud/dialogflow').v2; diff --git a/samples/generated/v2/documents.reload_document.js b/samples/generated/v2/documents.reload_document.js index 10ebaab1..d5ca2782 100644 --- a/samples/generated/v2/documents.reload_document.js +++ b/samples/generated/v2/documents.reload_document.js @@ -33,6 +33,16 @@ function main(name) { * the form `gs:///`. */ // const contentUri = 'abc123' + /** + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + /** + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + */ + // const smartMessagingPartialUpdate = true // Imports the Dialogflow library const {DocumentsClient} = require('@google-cloud/dialogflow').v2; diff --git a/samples/generated/v2/knowledge_bases.list_knowledge_bases.js b/samples/generated/v2/knowledge_bases.list_knowledge_bases.js index e876ad0d..41ec87d6 100644 --- a/samples/generated/v2/knowledge_bases.list_knowledge_bases.js +++ b/samples/generated/v2/knowledge_bases.list_knowledge_bases.js @@ -34,6 +34,28 @@ function main(parent) { * The next_page_token value returned from a previous list request. */ // const pageToken = 'abc123' + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * AND ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' // Imports the Dialogflow library const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; diff --git a/samples/generated/v2beta1/participants.suggest_articles.js b/samples/generated/v2beta1/participants.suggest_articles.js index 7c80483e..b6e0d0b1 100644 --- a/samples/generated/v2beta1/participants.suggest_articles.js +++ b/samples/generated/v2beta1/participants.suggest_articles.js @@ -35,9 +35,8 @@ function main(parent) { // const latestMessage = 'abc123' /** * Optional. Max number of messages prior to and including - * latest_message google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message - * to use as context when compiling the suggestion. By default 20 and at - * most 50. + * latest_message google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message to use as context + * when compiling the suggestion. By default 20 and at most 50. */ // const contextSize = 1234 /** diff --git a/src/v2/documents_client.ts b/src/v2/documents_client.ts index 5a3787d9..45da3a4d 100644 --- a/src/v2/documents_client.ts +++ b/src/v2/documents_client.ts @@ -337,6 +337,12 @@ export class DocumentsClient { const reloadDocumentMetadata = protoFilesRoot.lookup( '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' ) as gax.protobuf.Type; + const exportDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document' + ) as gax.protobuf.Type; + const exportDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { createDocument: new this._gaxModule.LongrunningDescriptor( @@ -359,6 +365,11 @@ export class DocumentsClient { reloadDocumentResponse.decode.bind(reloadDocumentResponse), reloadDocumentMetadata.decode.bind(reloadDocumentMetadata) ), + exportDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportDocumentResponse.decode.bind(exportDocumentResponse), + exportDocumentMetadata.decode.bind(exportDocumentMetadata) + ), }; // Put together the default options sent with requests. @@ -417,6 +428,7 @@ export class DocumentsClient { 'deleteDocument', 'updateDocument', 'reloadDocument', + 'exportDocument', ]; for (const methodName of documentsStubMethods) { const callPromise = this.documentsStub.then( @@ -1064,6 +1076,12 @@ export class DocumentsClient { * * For documents stored in Google Cloud Storage, these URIs must have * the form `gs:///`. + * @param {boolean} [request.importGcsCustomMetadata] + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @param {boolean} [request.smartMessagingPartialUpdate] + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1194,6 +1212,161 @@ export class DocumentsClient { protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata >; } + /** + * Exports a smart messaging candidate document into the specified + * destination. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * @param {google.cloud.dialogflow.v2.GcsDestination} request.gcsDestination + * Cloud Storage file path to export the document. + * @param {boolean} request.exportFullContent + * When enabled, export the full content of the document including empirical + * probability. + * @param {boolean} request.smartMessagingPartialUpdate + * When enabled, export the smart messaging allowlist document for partial + * update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/documents.export_document.js + * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async + */ + exportDocument( + request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + exportDocument( + request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportDocument( + request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportDocument( + request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.exportDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `exportDocument()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v2/documents.export_document.js + * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async + */ + async checkExportDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.exportDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } /** * Returns the list of all documents of the knowledge base. * @@ -1208,6 +1381,28 @@ export class DocumentsClient { * default 10 and at most 100. * @param {string} request.pageToken * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1309,6 +1504,28 @@ export class DocumentsClient { * default 10 and at most 100. * @param {string} request.pageToken * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -1358,6 +1575,28 @@ export class DocumentsClient { * default 10 and at most 100. * @param {string} request.pageToken * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} diff --git a/src/v2/documents_client_config.json b/src/v2/documents_client_config.json index 23bb7e66..bf9c3963 100644 --- a/src/v2/documents_client_config.json +++ b/src/v2/documents_client_config.json @@ -52,6 +52,11 @@ "timeout_millis": 60000, "retry_codes_name": "unavailable", "retry_params_name": "default" + }, + "ExportDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" } } } diff --git a/src/v2/gapic_metadata.json b/src/v2/gapic_metadata.json index 56df6aa2..f752de39 100644 --- a/src/v2/gapic_metadata.json +++ b/src/v2/gapic_metadata.json @@ -399,6 +399,11 @@ "reloadDocument" ] }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, "ListDocuments": { "methods": [ "listDocuments", @@ -436,6 +441,11 @@ "reloadDocument" ] }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, "ListDocuments": { "methods": [ "listDocuments", diff --git a/src/v2/knowledge_bases_client.ts b/src/v2/knowledge_bases_client.ts index f1a2e290..0e117b20 100644 --- a/src/v2/knowledge_bases_client.ts +++ b/src/v2/knowledge_bases_client.ts @@ -831,6 +831,33 @@ export class KnowledgeBasesClient { * default 10 and at most 100. * @param {string} request.pageToken * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -931,6 +958,33 @@ export class KnowledgeBasesClient { * default 10 and at most 100. * @param {string} request.pageToken * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} @@ -979,6 +1033,33 @@ export class KnowledgeBasesClient { * default 10 and at most 100. * @param {string} request.pageToken * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} diff --git a/src/v2beta1/participants_client.ts b/src/v2beta1/participants_client.ts index ce98b70e..e483813a 100644 --- a/src/v2beta1/participants_client.ts +++ b/src/v2beta1/participants_client.ts @@ -41,8 +41,7 @@ import * as gapicConfig from './participants_client_config.json'; const version = require('../../../package.json').version; /** - * Service for managing - * {@link google.cloud.dialogflow.v2beta1.Participant|Participants}. + * Service for managing {@link google.cloud.dialogflow.v2beta1.Participant|Participants}. * @class * @memberof v2beta1 */ @@ -878,12 +877,9 @@ export class ParticipantsClient { * Gets suggested articles for a participant based on specific historical * messages. * - * Note that - * {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} - * will only list the auto-generated suggestions, while - * {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} - * will try to compile suggestion based on the provided conversation context - * in the real time. + * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated + * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion + * based on the provided conversation context in the real time. * * @param {Object} request * The request object that will be sent. @@ -899,9 +895,8 @@ export class ParticipantsClient { * ID>/conversations//messages/`. * @param {number} [request.contextSize] * Optional. Max number of messages prior to and including - * {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message|latest_message} - * to use as context when compiling the suggestion. By default 20 and at - * most 50. + * {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message|latest_message} to use as context + * when compiling the suggestion. By default 20 and at most 50. * @param {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] * Optional. Parameters for a human assist query. * @param {object} [options] @@ -1221,21 +1216,14 @@ export class ParticipantsClient { return this.innerApiCalls.suggestSmartReplies(request, options, callback); } /** - * Deprecated. use - * {@link google.cloud.dialogflow.v2beta1.Participants.SuggestArticles|SuggestArticles} - * and - * {@link google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers|SuggestFaqAnswers} - * instead. + * Deprecated. use {@link google.cloud.dialogflow.v2beta1.Participants.SuggestArticles|SuggestArticles} and {@link google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers|SuggestFaqAnswers} instead. * * Gets suggestions for a participant based on specific historical * messages. * - * Note that - * {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} - * will only list the auto-generated suggestions, while - * {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} - * will try to compile suggestion based on the provided conversation context - * in the real time. + * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated + * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion + * based on the provided conversation context in the real time. * * @param {Object} request * The request object that will be sent. @@ -1551,9 +1539,9 @@ export class ParticipantsClient { /** * Deprecated: Use inline suggestion, event based suggestion or * Suggestion* API instead. - * See - * {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name|HumanAgentAssistantConfig.name} - * for more details. Removal Date: 2020-09-01. + * See {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name|HumanAgentAssistantConfig.name} for more + * details. + * Removal Date: 2020-09-01. * * Retrieves suggestions for live agents. * diff --git a/test/gapic_documents_v2.ts b/test/gapic_documents_v2.ts index 1b7f8cb9..446118d8 100644 --- a/test/gapic_documents_v2.ts +++ b/test/gapic_documents_v2.ts @@ -1116,6 +1116,200 @@ describe('v2.DocumentsClient', () => { }); }); + describe('exportDocument', () => { + it('invokes exportDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.exportDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes exportDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes exportDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.exportDocument(request), expectedError); + assert( + (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes exportDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.exportDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkExportDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkExportDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + describe('listDocuments', () => { it('invokes listDocuments without error', async () => { const client = new documentsModule.v2.DocumentsClient({