This commit is contained in:
ろむねこ 2024-07-18 12:32:26 +09:00
parent 8aa9a7717c
commit 653e5cbcb8
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -0,0 +1,46 @@
import { Directive } from "ask-sdk-model";
const DOCUMENT_ID = "child_list";
class ChildListDirective {
public createDirectivePayload = (dataSources = {}, tokenId = "documentToken"): Directive => {
return {
type: "Alexa.Presentation.APL.RenderDocument",
token: tokenId,
document: {
type: "Link",
src: "doc://alexa/apl/documents/" + DOCUMENT_ID
},
datasources: dataSources
}
};
public createDataSources = (listItems: string[]) => {
const datasource = {
"textListData": {
"type": "object",
"objectId": "textListSample",
"backgroundImage": {
"contentDescription": null,
"smallSourceUrl": null,
"largeSourceUrl": null,
"sources": [
{
"url": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/textlist/AlexaTextListBackground_Dark.png",
"size": "large"
}
]
},
"title": "子供を選択",
"listItems": listItems,
"logoUrl": "https://d2o906d8ln7ui1.cloudfront.net/images/templates_v3/logo/logo-modern-botanical-white.png"
}
};
return datasource;
}
}
export default new ChildListDirective();