當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript actions-on-google.DialogflowApp類代碼示例

本文整理匯總了TypeScript中actions-on-google.DialogflowApp的典型用法代碼示例。如果您正苦於以下問題:TypeScript DialogflowApp類的具體用法?TypeScript DialogflowApp怎麽用?TypeScript DialogflowApp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DialogflowApp類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: testDialogflow

function testDialogflow(request: express.Request, response: express.Response) {
    const app = new DialogflowApp({request, response});
    const actionMap = new Map();
    actionMap.set(app.StandardIntents.MAIN, () => {
        const order: Transactions.Order = app.buildOrder('foo');
        app.askForTransactionDecision(order, {
            type: app.Transactions.PaymentType.PAYMENT_CARD,
            displayName: 'VISA-1234',
            deliveryAddressRequired: true
        });
    });
    app.handleRequest(actionMap);
}
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:13,代碼來源:actions-on-google-tests.ts

示例2: DialogflowApp

export const helloWorld = functions.https.onRequest((request, response) => {
    console.log('Request headers: ' + JSON.stringify(request.headers));
    console.log('Request body: ' + JSON.stringify(request.body));


    let dialogApp = new DialogflowApp({ request, response });

    function ingredientList(app: DialogflowApp) {
        app.tell(`I see you want to know about ${app.getArgument('recipe_name')}`);
    }

    let actionMap = new Map();
    actionMap.set('IngredientList', ingredientList);

    dialogApp.handleRequest(actionMap);
});
開發者ID:wjones0,項目名稱:recipe,代碼行數:16,代碼來源:index.ts

示例3: ingredientList

 function ingredientList(app: DialogflowApp) {
     app.tell(`I see you want to know about ${app.getArgument('recipe_name')}`);
 }
開發者ID:wjones0,項目名稱:recipe,代碼行數:3,代碼來源:index.ts


注:本文中的actions-on-google.DialogflowApp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。