UNPKG

2.68 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 RegisterUpdateArgument = Api.GoogleActionsV2RegisterUpdateValue;
20/** @public */
21export interface RegisterUpdateOptions {
22 /**
23 * The Dialogflow/Actions SDK intent name to be triggered when the update is received.
24 * @public
25 */
26 intent: string;
27 /**
28 * The necessary arguments to fulfill the intent triggered on update.
29 * These can be retrieved using {@link Arguments#get|conv.arguments.get}.
30 * @public
31 */
32 arguments: Api.GoogleActionsV2Argument[];
33 /**
34 * The high-level frequency of the recurring update.
35 * @public
36 */
37 frequency: Api.GoogleActionsV2TriggerContextTimeContextFrequency;
38}
39/**
40 * Requests the user to register for daily updates.
41 *
42 * @example
43 * ```javascript
44 *
45 * // Actions SDK
46 * const app = actionssdk()
47 *
48 * app.intent('actions.intent.MAIN', conv => {
49 * conv.ask(new RegisterUpdate({
50 * frequency: 'DAILY',
51 * intent: 'show.image',
52 * arguments: [{
53 * name: 'image_to_show',
54 * textValue: 'image_type_1',
55 * }],
56 * }))
57 * })
58 *
59 * app.intent('show.image', conv => {
60 * const arg = conv.arguments.get('image_to_show') // will be 'image_type_1'
61 * // do something with arg
62 * })
63 *
64 * // Dialogflow
65 * const app = dialogflow()
66 *
67 * app.intent('Default Welcome Intent', conv => {
68 * conv.ask(new RegisterUpdate({
69 * frequency: 'DAILY',
70 * intent: 'Show Image',
71 * arguments: [{
72 * name: 'image_to_show',
73 * textValue: 'image_type_1',
74 * }],
75 * }))
76 * })
77 *
78 * app.intent('Show Image', conv => {
79 * const arg = conv.arguments.get('image_to_show') // will be 'image_type_1'
80 * // do something with arg
81 * })
82 * ```
83 *
84 * @public
85 */
86export declare class RegisterUpdate extends SoloHelper<'actions.intent.REGISTER_UPDATE', Api.GoogleActionsV2RegisterUpdateValueSpec> {
87 /**
88 * @param options RegisterUpdate options
89 * @public
90 */
91 constructor(options: RegisterUpdateOptions);
92}