UNPKG

2.08 kBTypeScriptView Raw
1/**
2 * Copyright 2018 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import * as Api from '../../api/v2';
17import { SoloHelper } from './helper';
18/** @public */
19export declare type ConfirmationArgument = boolean;
20/**
21 * Asks user for a confirmation.
22 *
23 * @example
24 * ```javascript
25 *
26 * // Actions SDK
27 * const app = actionssdk()
28 *
29 * app.intent('actions.intent.MAIN', conv => {
30 * conv.ask(new Confirmation('Are you sure you want to do that?'))
31 * })
32 *
33 * app.intent('actions.intent.CONFIRMATION', (conv, input, confirmation) => {
34 * if (confirmation) {
35 * conv.close(`Great! I'm glad you want to do it!`)
36 * } else {
37 * conv.close(`That's okay. Let's not do it now.`)
38 * }
39 * })
40 *
41 * // Dialogflow
42 * const app = dialogflow()
43 *
44 * app.intent('Default Welcome Intent', conv => {
45 * conv.ask(new Confirmation('Are you sure you want to do that?'))
46 * })
47 *
48 * // Create a Dialogflow intent with the `actions_intent_CONFIRMATION` event
49 * app.intent('Get Confirmation', (conv, input, confirmation) => {
50 * if (confirmation) {
51 * conv.close(`Great! I'm glad you want to do it!`)
52 * } else {
53 * conv.close(`That's okay. Let's not do it now.`)
54 * }
55 * })
56 * ```
57 *
58 * @public
59 */
60export declare class Confirmation extends SoloHelper<'actions.intent.CONFIRMATION', Api.GoogleActionsV2ConfirmationValueSpec> {
61 /**
62 * @param text The confirmation prompt presented to the user to
63 * query for an affirmative or negative response.
64 * @public
65 */
66 constructor(text: string);
67}