Created
September 14, 2019 19:24
-
-
Save MichaelSolati/f6c862f1a8ecf9d879f6f46df8c54480 to your computer and use it in GitHub Desktop.
Dialogflow Typing Namespace for TS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tslint:disable:no-import-side-effect no-namespace no-shadowed-variable */ | |
export namespace Dialogflow { | |
/** The basic card message. Useful for displaying information. */ | |
export interface BasicCard { | |
/** Optional. The title of the card. */ | |
title?: string; | |
/** Optional. The subtitle of the card. */ | |
subtitle?: string; | |
/** Required, unless image is present. The body text of the card. */ | |
formattedText?: string; | |
/** Optional. The image for the card. */ | |
image?: Image; | |
/** Optional. The collection of card buttons. */ | |
buttons?: Button[]; | |
} | |
/** Optional. Contains information about a button. */ | |
export interface Button { | |
/** Optional. The text to show on the button. */ | |
text?: string; | |
/** Optional. The text to send back to the Dialogflow API or a URI to open. */ | |
postback?: string; | |
} | |
/** The card response message. */ | |
export interface Card { | |
/** Optional. The title of the card. */ | |
title?: string; | |
/** Optional. The subtitle of the card. */ | |
subtitle?: string; | |
/** Optional. The public URI to an image file for the card. */ | |
imageUri?: string; | |
/** Optional. The collection of card buttons. */ | |
buttons?: Button[]; | |
} | |
/** The card for presenting a carousel of options to select from. */ | |
export interface CarouselSelect { | |
/** Required. Carousel items. */ | |
items: Item[]; | |
} | |
/** Represents a context. */ | |
export interface Context { | |
/** | |
* Required. The unique identifier of the context. Format: projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>. | |
* The Context ID is always converted to lowercase, may only contain characters in [a-zA-Z0-9_-%] and may be at most 250 bytes long. | |
*/ | |
name: string; | |
/** | |
* Optional. The number of conversational query requests after which the context expires. | |
* If set to 0 (the default) the context expires immediately. | |
* Contexts expire automatically after 20 minutes if there are no matching queries. | |
*/ | |
lifespanCount?: number; | |
/** Optional. The collection of parameters associated with this context. Refer to this doc for syntax. */ | |
parameters?: Struct; | |
} | |
/** Represents a single followup intent in the chain. */ | |
export interface FollowupIntentInfo { | |
/** The unique identifier of the followup intent. Format: projects/<Project ID>/agent/intents/<Intent ID>. */ | |
followupIntentName: string; | |
/** The unique identifier of the followup intent's parent. Format: projects/<Project ID>/agent/intents/<Intent ID>. */ | |
parentFollowupIntentName?: string; | |
} | |
/** The image response message. */ | |
export interface Image { | |
/** Optional. The public URI to an image file. */ | |
imageUri?: string; | |
/** Optional. A text description of the image to be used for accessibility, e.g., screen readers. */ | |
accessibilityText?: string; | |
} | |
/** | |
* Represents an intent. Intents convert a number of user expressions or patterns into an action. | |
* An action is an extraction of a user command or sentence semantics. | |
*/ | |
export interface Intent { | |
/** | |
* The unique identifier of this intent. Required for Intents.UpdateIntent and Intents.BatchUpdateIntents methods. | |
* Format: projects/<Project ID>/agent/intents/<Intent ID>. | |
*/ | |
name?: string; | |
/** Required. The name of this intent. */ | |
displayName?: string; | |
/** Represents the different states that webhooks can be in. */ | |
webhookState?: WebhookState; | |
/** | |
* Optional. The priority of this intent. Higher numbers represent higher priorities. | |
* If this is zero or unspecified, we use the default priority 500000. Negative numbers mean that the intent is disabled. | |
*/ | |
priority?: number; | |
/** Optional. Indicates whether this is a fallback intent. */ | |
isFallback?: boolean; | |
/** | |
* Optional. Indicates whether Machine Learning is disabled for the intent. | |
* Note: If ml_diabled setting is set to true, then this intent is not taken into account during inference in ML ONLY match mode. | |
* Also, auto-markup in the UI is turned off. | |
*/ | |
mlDisabled?: boolean; | |
/** | |
* Optional. The list of context names required for this intent to be triggered. | |
* Format: projects/<Project ID>/agent/sessions/-/contexts/<Context ID>. | |
*/ | |
inputContextNames?: string[]; | |
/** | |
* Optional. The collection of event names that trigger the intent. | |
* If the collection of input contexts is not empty, | |
* all of the contexts must be present in the active user session for an event to trigger this intent. | |
*/ | |
events?: string[]; | |
/** Optional. The collection of examples that the agent is trained on. */ | |
trainingPhrases?: TrainingPhrase[]; | |
/** Optional. The name of the action associated with the intent. Note: The action name must not contain whitespaces. */ | |
action?: string; | |
/** | |
* Optional. The collection of contexts that are activated when the intent is matched. | |
* Context messages in this collection should not set the parameters field. | |
* Setting the lifespanCount to 0 will reset the context when the intent is matched. | |
* Format: projects/<Project ID>/agent/sessions/-/contexts/<Context ID>. | |
*/ | |
outputContexts?: Context[]; | |
/** Optional. Indicates whether to delete all contexts in the current session when this intent is matched. */ | |
resetContexts?: boolean; | |
/** Optional. The collection of parameters associated with the intent. */ | |
parameters?: Parameter[]; | |
/** Optional. The collection of rich messages corresponding to the Response field in the Dialogflow console. */ | |
messages?: Message[]; | |
/** | |
* Optional. The list of platforms for which the first response will be taken from among the messages assigned to the DEFAULT_PLATFORM. | |
*/ | |
defaultResponsePlatforms?: Platform[]; | |
/** | |
* Read-only. The unique identifier of the root intent in the chain of followup intents. | |
* It identifies the correct followup intents chain for this intent. | |
* We populate this field only in the output. Format: projects/<Project ID>/agent/intents/<Intent ID>. | |
*/ | |
rootFollowupIntentName?: string; | |
/** | |
* Read-only after creation. The unique identifier of the parent intent in the chain of followup intents. | |
* You can set this field when creating an intent, for example with [intents.create][] or [intents.batchUpdate][], | |
* in order to make this intent a followup intent. It identifies the parent followup intent. | |
* Format: projects/<Project ID>/agent/intents/<Intent ID>. | |
*/ | |
parentFollowupIntentName?: string; | |
/** | |
* Read-only. Information about all followup intents that have this intent as a direct or indirect parent. | |
* We populate this field only in the output. | |
*/ | |
followupIntentInfo?: FollowupIntentInfo[]; | |
} | |
/** An item in the list. */ | |
export interface Item { | |
/** Required. Additional information about this option. */ | |
info: SelectItemInfo; | |
/** Required. The title of the list item. */ | |
title: string; | |
/** Optional. The main text describing the item. */ | |
description?: string; | |
/** Optional. The image to display. */ | |
image?: Image; | |
} | |
/** The suggestion chip message that allows the user to jump out to the app or website associated with this agent. */ | |
export interface LinkOutSuggestion { | |
/** Required. The name of the app or site this chip is linking to. */ | |
destinationName: string; | |
/** Required. The URI of the app or site to open when the user taps the suggestion chip. */ | |
uri: string; | |
} | |
/** The card for presenting a list of options to select from. */ | |
export interface ListSelect { | |
/** Optional. The overall title of the list. */ | |
title: string; | |
/** Required. List items. */ | |
items: Item[]; | |
} | |
/** Corresponds to the Response field in the Dialogflow console. */ | |
export interface Message { | |
/** Optional. The platform that this message is intended for. */ | |
platform: Platform; | |
// Union field message can be only one of the following: | |
/** The text response. */ | |
text?: Text; | |
/** The image response. */ | |
image?: Image; | |
/** The quick replies response. */ | |
quickReplies?: QuickReplies; | |
/** The card response. */ | |
card?: Card; | |
/** | |
* Returns a response containing a custom, platform-specific payload. | |
* See the Intent.Message.Platform type for a description of the structure that may be required for your platform. | |
*/ | |
payload?: Struct; | |
/** The voice and text-only responses for Actions on Google. */ | |
simpleResponses?: SimpleResponses; | |
/** The basic card response for Actions on Google. */ | |
basicCard?: BasicCard; | |
/** The suggestion chips for Actions on Google. */ | |
suggestions?: Suggestions; | |
/** The link out suggestion chip for Actions on Google. */ | |
linkOutSuggestion?: LinkOutSuggestion; | |
/** The list card response for Actions on Google. */ | |
listSelect?: ListSelect; | |
/** The carousel card response for Actions on Google. */ | |
carouselSelect?: CarouselSelect; | |
// End of list of possible types for union field message. | |
} | |
/** Represents intent parameters. */ | |
export interface Parameter { | |
/** The unique identifier of this parameter. */ | |
name: string; | |
/** Required. The name of the parameter. */ | |
displayName: string; | |
/** | |
* Optional. The definition of the parameter value. It can be: | |
* - a constant string | |
* - a parameter value defined as $parameterName | |
* - an original parameter value defined as $parameterName.original | |
* - a parameter value from some context defined as #contextName.parameter_name | |
*/ | |
value?: string; | |
/** | |
* Optional. The default value to use when the value yields an empty result. | |
* Default values can be extracted from contexts by using the following syntax: #contextName.parameter_name. | |
*/ | |
defaultValue?: string; | |
/** | |
* Optional. The name of the entity type, prefixed with @, that describes values of the parameter. | |
* If the parameter is required, this must be provided. | |
*/ | |
entityTypeDisplayName?: string; | |
/** | |
* Optional. Indicates whether the parameter is required. | |
* That is, whether the intent cannot be completed without collecting the parameter value. | |
*/ | |
mandatory?: boolean; | |
/** Optional. The collection of prompts that the agent can present to the user in order to collect value for the parameter. */ | |
prompts?: string[]; | |
/** Optional. Indicates whether the parameter represents a list of values. */ | |
isList?: boolean; | |
} | |
/** Represents a part of a training phrase. */ | |
export interface Part { | |
/** Required. The text for this part. */ | |
text: string; | |
/** Optional. The entity type name prefixed with @. This field is required for annotated parts of the training phrase. */ | |
entityType?: string; | |
/** | |
* Optional. The parameter name for the value extracted from the annotated part of the example. | |
* This field is required for annotated parts of the training phrase. | |
*/ | |
alias?: string; | |
/** | |
* Optional. Indicates whether the text was manually annotated. | |
* This field is set to true when the Dialogflow Console is used to manually annotate the part. | |
* When creating an annotated part with the API, you must set this to true. | |
*/ | |
userDefined?: boolean; | |
} | |
/** Represents different platforms that a rich message can be intended for. */ | |
export enum Platform { | |
/** Not specified. */ | |
PLATFORM_UNSPECIFIED, | |
/** Facebook. */ | |
FACEBOOK, | |
/** Slack. */ | |
SLACK, | |
/** Telegram. */ | |
TELEGRAM, | |
/** Kik. */ | |
KIK, | |
/** Skype. */ | |
SKYPE, | |
/** Line. */ | |
LINE, | |
/** Viber. */ | |
VIBER, | |
/** | |
* Actions on Google. When using Actions on Google, you can choose one of the specific Intent.Message types that mention support | |
* for Actions on Google, or you can use the advanced Intent.Message.payload field. | |
* The payload field provides access to AoG features not available in the specific message types. | |
* If using the Intent.Message.payload field, it should have a structure similar to the JSON message shown here. | |
* For more information, see Actions on Google Webhook Format | |
*/ | |
ACTIONS_ON_GOOGLE | |
} | |
/** The quick replies response message. */ | |
export interface QuickReplies { | |
/** Optional. The title of the collection of quick replies. */ | |
title?: string; | |
/** Optional. The collection of quick replies. */ | |
quickReplies?: string[]; | |
} | |
/** Additional info about the select item for when it is triggered in a dialog. */ | |
export interface SelectItemInfo { | |
/** Required. A unique key that will be sent back to the agent if this response is given. */ | |
key: string; | |
/** Optional. A list of synonyms that can also be used to trigger this item in dialog. */ | |
synonyms: string[]; | |
} | |
/** The simple response message containing speech or text. */ | |
export interface SimpleResponse { | |
/** One of textToSpeech or ssml must be provided. The plain text of the speech output. Mutually exclusive with ssml. */ | |
textToSpeech?: string; | |
/** | |
* One of textToSpeech or ssml must be provided. Structured spoken response to the user in the SSML format. | |
* Mutually exclusive with textToSpeech. | |
*/ | |
ssml?: string; | |
/** Optional. The text to display. */ | |
displayText: string; | |
} | |
/** | |
* The collection of simple response candidates. | |
* This message in QueryResult.fulfillment_messages and WebhookResponse.fulfillment_messages should contain only one SimpleResponse. | |
*/ | |
export interface SimpleResponses { | |
simpleResponses: SimpleResponse[]; | |
} | |
export interface Struct { | |
[key: string]: any; | |
} | |
/** The suggestion chip message that the user can tap to quickly post a reply to the conversation. */ | |
export interface Suggestion { | |
/** Required. The text shown the in the suggestion chip. */ | |
title: string; | |
} | |
/** The collection of suggestions. */ | |
export interface Suggestions { | |
suggestions: Suggestion[]; | |
} | |
/** The text response message. */ | |
export interface Text { | |
/** Optional. The collection of the agent's responses. */ | |
text?: string[]; | |
} | |
/** Represents an example that the agent is trained on. */ | |
export interface TrainingPhrase { | |
/** Output only. The unique identifier of this training phrase. */ | |
name?: string; | |
/** Required. The type of the training phrase. */ | |
type: Type; | |
/** | |
* Required. The ordered list of training phrase parts. The parts are concatenated in order to form the training phrase. | |
* Note: The API does not automatically annotate training phrases like the Dialogflow Console does. | |
* Note: Do not forget to include whitespace at part boundaries, | |
* so the training phrase is well formatted when the parts are concatenated. | |
* If the training phrase does not need to be annotated with parameters, | |
* you just need a single part with only the Part.text field set. | |
* If you want to annotate the training phrase, you must create multiple parts, | |
* where the fields of each part are populated in one of two ways: Part.text is set to a part of the phrase that has no parameters. | |
* Part.text is set to a part of the phrase that you want to annotate, and the entityType, alias, and userDefined fields are all set. | |
*/ | |
parts: Part[]; | |
/** | |
* Optional. Indicates how many times this example was added to the intent. | |
* Each time a developer adds an existing sample by editing an intent or training, this counter is increased. | |
*/ | |
timesAddedCount?: number; | |
} | |
/** Represents different types of training phrases. */ | |
export enum Type { | |
/** Not specified. This value should never be used. */ | |
TYPE_UNSPECIFIED, | |
/** Examples do not contain @-prefixed entity type names, but example parts can be annotated with entity types. */ | |
EXAMPLE, | |
/** | |
* Templates are not annotated with entity types, but they can contain @-prefixed entity type names as substrings. | |
* Template mode has been deprecated. Example mode is the only supported way to create new training phrases. | |
* If you have existing training phrases that you've created in template mode, those will continue to work. | |
*/ | |
TEMPLATE | |
} | |
/** Represents the different states that webhooks can be in. */ | |
export enum WebhookState { | |
/** Webhook is disabled in the agent and in the intent. */ | |
WEBHOOK_STATE_UNSPECIFIED, | |
/** Webhook is enabled in the agent and in the intent. */ | |
WEBHOOK_STATE_ENABLED, | |
/** Webhook is enabled in the agent and in the intent. Also, each slot filling prompt is forwarded to the webhook. */ | |
WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment