From 26bb67e8d7db5735ca266ba4fb0ec7257a5c72b7 Mon Sep 17 00:00:00 2001 From: rbot <30998401+rk-7@users.noreply.github.com> Date: Thu, 23 Nov 2017 17:44:33 +0530 Subject: [PATCH] Fixed lint errors for alexa-sdk --- types/alexa-sdk/alexa-sdk-tests.ts | 6 +- types/alexa-sdk/index.d.ts | 821 ++++++++++++++--------------- 2 files changed, 394 insertions(+), 433 deletions(-) diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts index 0c511979d4..c77bc93091 100644 --- a/types/alexa-sdk/alexa-sdk-tests.ts +++ b/types/alexa-sdk/alexa-sdk-tests.ts @@ -8,13 +8,13 @@ const handler = (event: Alexa.RequestBody, context: Alexa.Context }; const handlers: Alexa.Handlers = { - 'LaunchRequest': function () { + 'LaunchRequest': function() { this.emit('SayHello'); }, - 'HelloWorldIntent': function () { + 'HelloWorldIntent': function() { this.emit('SayHello'); }, - 'SayHello': function () { + 'SayHello': function() { this.emit(':tell', 'Hello World!'); } }; diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 744523b2ac..e4ea78c104 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Alexa SDK for Node.js 1.0.21 +// Type definitions for Alexa SDK for Node.js 1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle // Huw @@ -6,45 +6,66 @@ // Ben // rk-7 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.7 +// TypeScript Version: 2.2 import { i18n } from "i18next"; export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export let StateString: string; //#region Types -export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; -export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; - export interface CardImage { + /** + * Recommended size (in px): 720w x 480h + */ smallImageUrl: string; + /** + * Recommended size (in px): 1200w x 800h + */ largeImageUrl: string; } +export interface ImageSource { + url: string; + widthPixels?: number; + heightPixels?: number; + /** + * Possible values: 'X_SMALL' | 'SMALL' | 'MEDIUM' | 'LARGE' | 'X_LARGE' + * Recommended size respectively (in px): 480 x 320 | 720 x 480 | 960 x 640 | 1200 x 800 | 1920 x 1280 + */ + size?: string; +} export interface Image { - smallImageUrl: string; - largeImageUrl: string; contentDescription: string; - sources: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>; + sources: ImageSource[]; } -export type TextField = { - text: string, - type: string -}; -export type TextContent = { - primaryText: TextField, - secondaryText: TextField, - tertiaryText: TextField, -} -export type ListItem = { image: Image; token: string; textContent: TextContent; }; -export type Template = { - title: string; - token: string; - backgroundImage: Image; - backButton: string; +export interface TextField { + text: string; type: string; - image: Image; - listItems: ListItem[]; -}; +} +export interface TextContent { + primaryText?: TextField; + secondaryText?: TextField; + tertiaryText?: TextField; +} +export interface ListItem { + image?: Image; + token: string; + textContent?: TextContent; +} +export interface Template { + title?: string; + token: string; + backgroundImage?: Image; + /** + * Possible values 'HIDDEN' | 'VISIBLE' + */ + backButton?: string; + /** + * Possible values 'BodyTemplate1' | 'BodyTemplate2'| 'BodyTemplate3'| 'BodyTemplate6'| 'ListTemplate1'| 'ListTemplate2' + */ + type: string; + image?: Image; + listItems?: ListItem[]; +} export interface AlexaObject extends Handler { _event: any; @@ -70,28 +91,21 @@ export interface Handler { emitWithState: any; state: any; handler: any; - i18n: i18n, - locale: any, + i18n: i18n; + locale: any; event: RequestBody; attributes: any; context: any; - callback: Function; + callback: (param: any) => void; name: any; isOverriden: any; t: (token: string, ...args: any[]) => void; response: ResponseBuilder; } -export enum PLAYER_ACTIVITY { - IDLE = 'IDLE', - PAUSED = 'PAUSED', - PLAYING = 'PLAYING', - BUFFER_UNDERRUN = 'BUFFER_UNDERRUN', - FINISHED = 'FINISHED', - STOPPED = 'STOPPED' -} + export interface Context { - System: System - AudioPlayer: AudioPlayer + System: System; + AudioPlayer: AudioPlayer; } export interface Application { applicationId: string; @@ -107,7 +121,10 @@ export interface System { export interface AudioPlayer { token: string; offsetInMilliseconds: number; - playerActivity: PLAYER_ACTIVITY; + /** + * Possible values: 'IDLE'|'PAUSED'|'PLAYING'|'BUFFER_UNDERRUN'|'FINISHED'|'STOPPED' + */ + playerActivity: string; } export interface RequestBody { version: string; @@ -122,23 +139,25 @@ export interface Session { application: Application; user: SessionUser; } - export interface SessionUser { userId: string; accessToken?: string; - /** - * @deprecated - */ permissions: Permissions; } export interface Permissions { + /** + * @deprecated + */ consentToken: string; [key: string]: string; } export interface LaunchRequest extends Request { } export interface IntentRequest extends Request { - dialogState?: DialogStates; + /** + * Possible values: 'STARTED'| 'IN_PROGRESS'| 'COMPLETED' + */ + dialogState?: string; intent?: Intent; } @@ -177,14 +196,20 @@ export interface Resolutions { } export interface SlotValue { - confirmationStatus?: ConfirmationStatuses; + /** + * Possible values: 'NONE'| 'DENIED'| 'CONFIRMED' + */ + confirmationStatus?: string; name: string; value?: any; resolutions?: Resolutions; } export interface Intent { - confirmationStatus?: ConfirmationStatuses; + /** + * Possible values: 'NONE'| 'DENIED'| 'CONFIRMED' + */ + confirmationStatus?: string; name: string; slots: Record; } @@ -214,24 +239,24 @@ export interface Card { title?: string; content?: string; text?: string; - image?: Image; + image?: CardImage; } export interface Reprompt { outputSpeech: OutputSpeech; } -export declare const CARD_TYPES: { +export const CARD_TYPES: { STANDARD: 'Standard', SIMPLE: 'Simple', LINK_ACCOUNT: 'LinkAccount', ASK_FOR_PERMISSIONS_CONSENT: 'AskForPermissionsConsent' }; -export declare const HINT_TYPES: { +export const HINT_TYPES: { PLAIN_TEXT: 'PlainText' }; -export declare const DIRECTIVE_TYPES: { +export const DIRECTIVE_TYPES: { AUDIOPLAYER: { PLAY: 'AudioPlayer.Play', STOP: 'AudioPlayer.Stop', @@ -256,466 +281,448 @@ export interface ApiClientOptions { export interface ApiClientResponse { statusCode: string; statusText: string; - body: Object; - headers: Object + body: object; + headers: object; } +/** + * Todo-ListItem class + * Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html + */ export interface ListItemObject { - value: string, - status: string, - version: any + /** + * item id (String, limit 60 characters) + */ + id: string; + /** + * item value (String, limit is 256 characters) + */ + value: string; + /** + * item status + * Possible values: "active" or "completed" + */ + status?: string; + /** + * item version (Positive integer | string) + */ + version?: any; + /** + * created time (ISO 8601 time format with time zone) + */ + createdTime: Date; + /** + * updated time (ISO 8601 time format with time zone) + */ + updatedTime: Date; + /** + * URL to retrieve the item (String) + */ + href?: string; } +/** + * Todo-List class + * Refer https://developer.amazon.com/docs/custom-skills/access-the-alexa-shopping-and-to-do-lists.html + */ export interface ListObject { - name: string, - status: string, - version: any + /** + * list id (String) + */ + listId: string; + /** + * list name (String) + */ + name: string; + /** + * "active" or "archived" (Enum) + */ + state?: string; + /** + * Possibly status of the list (or state?) + * Fetched from commit eebba0d at https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/ + * File path: alexa-skills-kit-sdk-for-nodejs/lib/services/listManagementService.js + */ + status?: string; + /** + * list version (long | string) + */ + version?: any; + /** + * Urls to active and completed items + * href is lint to the items having certain status. + * The status can be "active" or "completed". + */ + statusMap: { href: string; status: string; }; + /** + * Items that belong to this list. + */ + items: ListItemObject[]; } //#endregion //#region templateBuilders +/** + * Generates templates for Echo Show device. + */ export namespace templateBuilders { - export interface SetTextContent> { + interface SetTextContent> { setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; } - export interface SetListItems> { + interface SetListItems> { setListItems(listItems: ListItem[]): T; } - export abstract class TemplateBuilder> { - public template: Template; + /** + * Refer https://developer.amazon.com/docs/custom-skills/display-interface-reference.html#image-sizes + */ + abstract class TemplateBuilder> { + template: Template; constructor(); /** * Sets the title of the template - * - * @param {string} title - * @returns - * @memberof TemplateBuilder + * @param title title + * @returns TemplateBuilder */ - public setTitle(title: string): T; + setTitle(title: string): T; /** * Sets the token of the template - * - * @param {string} token - * @returns - * @memberof TemplateBuilder + * @param token token + * @returns TemplateBuilder */ - public setToken(token: string): T; + setToken(token: string): T; /** * Sets the background image of the template - * - * @param {Image} image - * @returns - * @memberof TemplateBuilder + * @param image image + * @returns TemplateBuilder */ - public setBackgroundImage(image: Image): T; + setBackgroundImage(image: Image): T; /** * Sets the backButton behavior - * - * @param {string} backButtonBehavior 'VISIBLE' or 'HIDDEN' - * @returns - * @memberof TemplateBuilder + * @param backButtonBehavior 'VISIBLE' or 'HIDDEN' + * @returns TemplateBuilder */ - public setBackButtonBehavior(backButtonBehavior: string): T; + setBackButtonBehavior(backButtonBehavior: string): T; /** * Builds the template JSON object - * - * @returns - * @memberof TemplateBuilder + * @returns Template */ - public build(): Template; - // /** - // * Sets the text content for the template - // * - // * @param {TextField} primaryText - // * @param {TextField} secondaryText - // * @param {TextField} tertiaryText - // * @returns TemplateBuilder - // * @memberof TemplateBuilder - // */ - // public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): T; + build(): Template; } /** * Used to build a list of ListItems for ListTemplate - * - * @class ListItemBuilder */ - export class ListItemBuilder { + class ListItemBuilder { constructor(); - public items: ListItem[]; + items: ListItem[]; /** * Add an item to the list of template - * - * @param {Image} image - * @param {string} token - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText - * @memberof ListItemBuilder + * @param image image + * @param token token + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText */ - public addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; + addItem(image: Image, token: string, primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): ListItemBuilder; - public build(): ListItem[]; + build(): ListItem[]; } /** * Used to create BodyTemplate1 objects - * - * @class BodyTemplate1Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent{ + class BodyTemplate1Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate1Builder - * @memberof BodyTemplate1Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate1Builder; } /** * Used to create BodyTemplate2 objects - * - * @class BodyTemplate2Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { + class BodyTemplate2Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the image for the template - * - * @param {Image} image - * @returns - * @memberof BodyTemplate2Builder + * @param image image + * @returns BodyTemplate2Builder */ - public setImage(image: Image): BodyTemplate2Builder + setImage(image: Image): BodyTemplate2Builder; /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate2Builder - * @memberof BodyTemplate2Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate2Builder; } /** * Used to create BodyTemplate3 objects - * - * @class BodyTemplate3Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { + class BodyTemplate3Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the image for the template - * - * @param {any} image - * @returns - * @memberof BodyTemplate3Builder + * @param image image + * @returns BodyTemplate3Builder */ - public setImage(image: any): BodyTemplate3Builder; + setImage(image: any): BodyTemplate3Builder; /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate3Builder - * @memberof BodyTemplate3Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate3Builder; } /** * Used to create BodyTemplate6 objects - * - * @class BodyTemplate6Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { + class BodyTemplate6Builder extends TemplateBuilder implements SetTextContent { constructor(); /** * Sets the image for the template - * - * @param {any} image - * @returns - * @memberof BodyTemplate6Builder + * @param image image + * @returns BodyTemplate6Builder */ - public setImage(image: any): BodyTemplate6Builder; + setImage(image: any): BodyTemplate6Builder; /** * Sets the text content for the template - * - * @param {TextField} primaryText - * @param {TextField} secondaryText - * @param {TextField} tertiaryText + * @param primaryText primaryText + * @param secondaryText secondaryText + * @param tertiaryText tertiaryText * @returns BodyTemplate6Builder - * @memberof BodyTemplate6Builder */ - public setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; + setTextContent(primaryText: TextField, secondaryText?: TextField, tertiaryText?: TextField): BodyTemplate6Builder; } /** * Used to create BodyTemplate7 objects - * - * @class BodyTemplate7Builder - * @extends {TemplateBuilder} */ - export class BodyTemplate7Builder extends TemplateBuilder { + class BodyTemplate7Builder extends TemplateBuilder { constructor(); /** * Sets the image for the template - * - * @param {Image} image - * @returns - * @memberof BodyTemplate7Builder + * @param image image + * @returns BodyTemplate7Builder */ - setImage(image: Image): BodyTemplate7Builder + setImage(image: Image): BodyTemplate7Builder; } /** * Used to create ListTemplate1 objects - * - * @class ListTemplate1Builder - * @extends {TemplateBuilder} */ - export class ListTemplate1Builder extends TemplateBuilder implements SetListItems { + class ListTemplate1Builder extends TemplateBuilder implements SetListItems { constructor(); /** * Set the items for the list - * - * @param {any} listItems - * @returns - * @memberof ListTemplate1Builder + * @param listItems listItems + * @returns ListTemplate1Builder */ setListItems(listItems: ListItem[]): ListTemplate1Builder; } /** * Used to create ListTemplate2 objects - * - * @class ListTemplate2Builder - * @extends {TemplateBuilder} */ - export class ListTemplate2Builder extends TemplateBuilder implements SetListItems { + class ListTemplate2Builder extends TemplateBuilder implements SetListItems { constructor(); /** * Set the items for the list - * - * @param {any} listItems - * @returns - * @memberof ListTemplate2Builder + * @param listItems listItems + * @returns ListTemplate2Builder */ setListItems(listItems: ListItem[]): ListTemplate2Builder; } - } //#endregion //#region services export namespace services { - export interface ApiClient { + interface ApiClient { /** * Make a POST API call to the specified uri with headers and optional body - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers Key value pair of headers - * @param {string} body post body to send - * @returns {Promise} - * @memberof ApiClient + * @param uri http(s?) endpoint to call + * @param headers Key value pair of headers + * @param body post body to send + * @returns Promise */ - post(uri: string, headers: Object, body?: string): Promise; + post(uri: string, headers: object, body?: string): Promise; /** * Make a PUT API call to the specified uri with headers and optional body - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers Key value pair of headers - * @param {string} body post body to send - * @returns {Promise} - * @memberof ApiClient + * @param uri http(s?) endpoint to call + * @param headers Key value pair of headers + * @param body post body to send + * @returns Promise */ - put(uri: string, headers: Object, body?: string): Promise; + put(uri: string, headers: object, body?: string): Promise; /** * Make a GET API call to the specified uri with headers - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers key value pair of headers - * @returns {Promise} - * @memberof ApiClient + * @param uri http(s?) endpoint to call + * @param headers key value pair of headers + * @returns Promise */ - get(uri: string, headers: Object): Promise; + get(uri: string, headers: object): Promise; /** - * Make a DELETE API call to the specified uri with headers - * @param {string} uri http(s?) endpoint to call - * @param {Object} headers key value pair of headers - * @returns {Promise} - */ - delete(uri: string, headers: Object): Promise; + * Make a DELETE API call to the specified uri with headers + * @param uri http(s?) endpoint to call + * @param headers key value pair of headers + * @returns Promise + */ + delete(uri: string, headers: object): Promise; } - export class DeviceAddressService { + class DeviceAddressService { /** * Create an instance of DeviceAddressService - * @param {ApiClient} [apiClient=new ApiClient()] ApiClient - * @memberOf DeviceAddressService + * @param [apiClient=new ApiClient()] ApiClient */ constructor(apiClient: ApiClient); /** * Get full address information from Alexa Device Address API - * @param {string} deviceId deviceId from Alexa request - * @param {string} apiEndpoint API apiEndpoint from Alexa request - * @param {string} token bearer token for device address permission - * @returns {Promise} - * @memberOf DeviceAddressService + * @param deviceId deviceId from Alexa request + * @param apiEndpoint API apiEndpoint from Alexa request + * @param token bearer token for device address permission + * @returns Promise */ - getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; + getFullAddress(deviceId: string, apiEndpoint: string, token: string): Promise; /** * Get country and postal information from Alexa Device Address API - * @param {string} deviceId deviceId from Alexa request - * @param {string} apiEndpoint API apiEndpoint from Alexa request - * @param {string} token bearer token for device address permission - * @returns {Promise} - * @memberOf DeviceAddressService + * @param deviceId deviceId from Alexa request + * @param apiEndpoint API apiEndpoint from Alexa request + * @param token bearer token for device address permission + * @returns Promise */ - getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; + getCountryAndPostalCode(deviceId: string, apiEndpoint: string, token: string): Promise; } - export class DirectiveService { - + class DirectiveService { /** * Creates an instance of DirectiveService. - * @param {ApiClient} [apiClient=new ApiClient()] ApiClient - * @memberof DirectiveService + * @param [apiClient=new ApiClient()] ApiClient */ constructor(apiClient: ApiClient); /** * Send the specified directiveObj to Alexa directive service * - * @param {Object} directive directive to send to service - * @param {string} apiEndpoint API endpoint from Alexa request - * @param {string} token bearer token for directive service - * @returns {Promise} - * @memberof DirectiveService + * @param directive directive to send to service + * @param apiEndpoint API endpoint from Alexa request + * @param token bearer token for directive service + * @returns Promise */ - enqueue(directive: Object, apiEndpoint: string, token: string): Promise; + enqueue(directive: object, apiEndpoint: string, token: string): Promise; } - export class ListManagementService { - + class ListManagementService { /** * Create an instance of ListManagementService - * @param apiClient + * @param apiClient apiClient */ constructor(apiClient: ApiClient); /** * Set apiEndpoint address, default is 'https://api.amazonalexa.com' - * @param apiEndpoint + * @param apiEndpoint apiEndpoint * @returns void - * @memberOf ListManagementService */ setApiEndpoint(apiEndpoint: string): void; /** * Get currently set apiEndpoint address - * @returns {string} - * @memberOf ListManagementService + * @returns string */ getApiEndpoint(): string; /** * Retrieve the metadata for all customer lists, including the customer's default lists - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param token bearer token for list management permission + * @returns Promise */ - getListsMetadata(token: string): Promise; + getListsMetadata(token: string): Promise; /** * Create a custom list. The new list name must be different than any existing list name - * @param {ListObject} listObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listObject listObject + * @param token bearer token for list management permission + * @returns Promise */ - createList(listObject: ListObject, token: string): Promise + createList(listObject: ListObject, token: string): Promise; /** * Retrieve list metadata including the items in the list with requested status - * @param {string} listId unique Id associated with the list - * @param {string} itemStatus itemsStatus can be either 'active' or 'completed' - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemStatus itemsStatus can be either 'active' or 'completed' + * @param token bearer token for list management permission + * @returns Promise */ - getList(listId: string, itemStatus: string, token: string): Promise; + getList(listId: string, itemStatus: string, token: string): Promise; /** * Update a custom list. Only the list name or state can be updated - * @param {string} listId unique Id associated with the list - * @param {ListObject} listObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param listObject listObject + * @param token bearer token for list management permission + * @returns Promise */ - updateList(listId: string, listObject: ListObject, token: string): Promise; + updateList(listId: string, listObject: ListObject, token: string): Promise; /** * Delete a custom list - * @param {string} listId unique Id associated with the list - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param token bearer token for list management permission + * @returns Promise */ - deleteList(listId: string, token: string): Promise; + deleteList(listId: string, token: string): Promise; /** * Create an item in an active list or in a default list - * @param {string} listId unique Id associated with the list - * @param {ListItemObject} listItemObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param listItemObject listItemObject + * @param token bearer token for list management permission + * @returns Promise */ - createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; + createListItem(listId: string, listItemObject: ListItemObject, token: string): Promise; /** * Retrieve single item within any list by listId and itemId - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemId unique Id associated with the item + * @param token bearer token for list management permission + * @returns Promise */ - getListItem(listId: string, itemId: string, token: string): Promise; + getListItem(listId: string, itemId: string, token: string): Promise; /** * Update an item value or item status - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {ListItemObject} listItemObject - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemId unique Id associated with the item + * @param listItemObject listItemObject + * @param token bearer token for list management permission + * @returns Promise */ - updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; + updateListItem(listId: string, itemId: string, listItemObject: ListItemObject, token: string): Promise; /** * Delete an item in the specified list - * @param {string} listId unique Id associated with the list - * @param {string} itemId unique Id associated with the item - * @param {string} token bearer token for list management permission - * @returns {Promise} - * @memberOf ListManagementService + * @param listId unique Id associated with the list + * @param itemId unique Id associated with the item + * @param token bearer token for list management permission + * @returns Promise */ - deleteListItem(listId: string, itemId: string, token: string): Promise; + deleteListItem(listId: string, itemId: string, token: string): Promise; } } //#endregion @@ -723,155 +730,132 @@ export namespace services { /** * Responsible for building JSON responses as per the Alexa skills kit interface * https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-body-syntax - * - * @class ResponseBuilder */ export class ResponseBuilder { constructor(alexaHandler: Handler); /** * Have Alexa say the provided speechOutput to the user - * - * @param {string} speechOutput - * @returns - * @memberof ResponseBuilder + * @param speechOutput speechOutput + * @returns ResponseBuilder */ speak(speechOutput: string): ResponseBuilder; /** * Have alexa listen for speech from the user. If the user doesn't respond within 8 seconds * then have alexa reprompt with the provided reprompt speech - * @param {string} repromptSpeech - * @returns - * @memberof ResponseBuilder + * @param repromptSpeech repromptSpeech + * @returns ResponseBuilder */ listen(repromptSpeech: string): ResponseBuilder; /** * Render a card with the following title, content and image - * - * @param {string} cardTitle - * @param {string} cardContent - * @param {{smallImageUrl : string, largeImageUrl : string}} cardImage - * @returns - * @memberof ResponseBuilder + * @param cardTitle cardTitle + * @param cardContent cardContent + * @param cardImage cardImage + * @returns ResponseBuilder */ cardRenderer(cardTitle: string, cardContent: string, cardImage: CardImage): ResponseBuilder; /** * Render a link account card - * - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ linkAccountCard(): ResponseBuilder; /** * Render a askForPermissionsConsent card - * @param {[{ [key: string]: string }]} permissions - * @returns - * @memberOf ResponseBuilder + * @param permissions permissions + * @returns ResponseBuilder */ askForPermissionsConsentCard(permissions: [{ [key: string]: string }]): ResponseBuilder; /** * Creates a play, stop or clearQueue audioPlayer directive depending on the directive type passed in. * @deprecated - use audioPlayerPlay, audioPlayerStop, audioPlayerClearQueue instead - * @param {string} directiveType - * @param {string} behavior - * @param {string} url - * @param {string} token - * @param {string} expectedPreviousToken - * @param {number} offsetInMilliseconds - * @returns - * @memberof ResponseBuilder + * @param directiveType directiveType + * @param behavior behavior + * @param url url + * @param token token + * @param expectedPreviousToken expectedPreviousToken + * @param offsetInMilliseconds offsetInMilliseconds + * @returns ResponseBuilder */ audioPlayer(directiveType: string, behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; /** * Creates an AudioPlayer play directive - * - * @param {string} behavior Describes playback behavior. Accepted values: + * @param behavior Describes playback behavior. Accepted values: * REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams. * ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream. * REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream. - * @param {string} url Identifies the location of audio content at a remote HTTPS location. - * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the - * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. + * @param url Identifies the location of audio content at a remote HTTPS location. + * The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the + * files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. * The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps. - * @param {string} token A token that represents the audio stream. This token cannot exceed 1024 characters - * @param {string} expectedPreviousToken A token that represents the expected previous stream. - * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions + * @param token A token that represents the audio stream. This token cannot exceed 1024 characters + * @param expectedPreviousToken A token that represents the expected previous stream. + * This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions * if requests to progress through a playlist and change tracks occur at the same time. - * @param {number} offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. + * @param offsetInMilliseconds The timestamp in the stream from which Alexa should begin playback. * Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ audioPlayerPlay(behavior: string, url: string, token: string, expectedPreviousToken: string, offsetInMilliseconds: number): ResponseBuilder; /** * Creates an AudioPlayer Stop directive - Stops the current audio Playback - * - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ audioPlayerStop(): ResponseBuilder; /** * Creates an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream, * or clear the queue and stop any currently playing stream. - * - * @param {string} clearBehavior Describes the clear queue behavior. Accepted values: + * @param clearBehavior Describes the clear queue behavior. Accepted values: * CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream * CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable). - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ audioPlayerClearQueue(clearBehavior: string): ResponseBuilder; /** * Creates a Display RenderTemplate Directive - * * Use a template builder to generate a template object - * - * @param {Template} template - * @returns - * @memberof ResponseBuilder + * @param template template + * @returns ResponseBuilder */ renderTemplate(template: Template): ResponseBuilder; /** * Creates a hint directive - show a hint on the screen of the echo show - * - * @param {string} hintText text to show on the hint - * @param {string} hintType (optional) Default value : PlainText - * @returns - * @memberof ResponseBuilder + * @param hintText text to show on the hint + * @param hintType (optional) Default value : PlainText + * @returns ResponseBuilder */ hint(hintText: string, hintType: string): ResponseBuilder; /** * Creates a VideoApp play directive to play a video - * - * @param {string} source Identifies the location of video content at a remote HTTPS location. + * @param source Identifies the location of video content at a remote HTTPS location. * The video file must be hosted at an Internet-accessible HTTPS endpoint. - * @param {{title : string, subtitle : string}} metadata (optional) Contains an object that provides the + * @param metadata (optional) Contains an object that provides the * information that can be displayed on VideoApp. - * @returns - * @memberof ResponseBuilder + * @returns ResponseBuilder */ playVideo(source: string, metadata: { title: string, subtitle: string }): ResponseBuilder; } //#endregion //#region directives export namespace directives { - export class VoicePlayerSpeakDirective { + class VoicePlayerSpeakDirective { + header: { requestId: string }; + directive: { type: string, speech: string }; /** * Creates an instance of VoicePlayerSpeakDirective. - * @param {string} requestId - requestId from which the call is originated from - * @param {string} speechContent - Contents of the speech directive either in plain text or SSML. - * @memberof DirectiveService + * @param requestId - requestId from which the call is originated from + * @param speechContent - Contents of the speech directive either in plain text or SSML. */ constructor(requestId: string, speechContent: string); } @@ -879,97 +863,74 @@ export namespace directives { //#endregion //#region utils export namespace utils { - export class ImageUtils { + namespace ImageUtils { /** * Creates an image object with a single source - * * These images may be in either JPEG or PNG formats, with the appropriate file extensions. * An image cannot be larger than 2 MB * You must host the images at HTTPS URLs that are publicly accessible. * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. - * - * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, - * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, * which means that larger images will be downscaled for display on Echo Show if provided. - * * example : ImageUtils.makeImage('https://url/to/my/img.png', 300, 400, 'SMALL', 'image description') - * - * @static - * @param {string} url url of the image - * @param {number} widthPixels (optional) width of the image in pixels - * @param {number} heightPixels (optional) height of the image in pixels - * @param {string} size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) - * @param {string} description text used to describe the image in a screen reader - * @returns - * @memberof ImageUtils + * @param url url of the image + * @param widthPixels (optional) width of the image in pixels + * @param heightPixels (optional) height of the image in pixels + * @param size size of the image (X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE) + * @param description text used to describe the image in a screen reader + * @returns Image */ - public static makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; + function makeImage(url: string, widthPixels?: number, heightPixels?: number, size?: string, description?: string): Image; /** - * - * Creates an image object with a multiple sources, source images are provided as an array of image objects - * - * These images may be in either JPEG or PNG formats, with the appropriate file extensions. - * An image cannot be larger than 2 MB - * You must host the images at HTTPS URLs that are publicly accessible. - * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. - * - * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, - * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, - * which means that larger images will be downscaled for display on Echo Show if provided. - * example : - * let imgArr = [ - * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, - * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, - * ] - * ImageUtils.makeImage(imgArr, 'image description') - * - * @static - * @param {{url : string, widthPixels : number, heightPixels : number, size : string}[]} imgArr - * @param {string} description text used to describe the image in a screen reader - * @returns - * @memberof ImageUtils - */ - public static makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; + * Creates an image object with a multiple sources, source images are provided as an array of image objects + * These images may be in either JPEG or PNG formats, with the appropriate file extensions. + * An image cannot be larger than 2 MB + * You must host the images at HTTPS URLs that are publicly accessible. + * widthPixels and heightPixels are optional - Do not include them unless they are exactly correct. + * By default, for Echo Show, size takes the value X_SMALL. If the other size values are included, + * then the order of precedence for displaying images begins with X_LARGE and proceeds downward, + * which means that larger images will be downscaled for display on Echo Show if provided. + * example : + * let imgArr = [ + * { 'https://url/to/my/small.png', 300, 400, 'SMALL' }, + * { 'https://url/to/my/large.png', 900, 1200, 'LARGE' }, + * ] + * ImageUtils.makeImage(imgArr, 'image description') + * + * @param imgArr Array of Image + * @param description text used to describe the image in a screen reader + * @returns Image + */ + function makeImages(imgArr: Array<{ url: string, widthPixels: number, heightPixels: number, size: string }>, description: string): Image; } /** * Utility methods for building TextField objects - * - * @class TextUtils */ - export class TextUtils { - + namespace TextUtils { /** * Creates a plain TextField object with contents : text - * - * @static - * @param {string} text contents of plain text object - * @returns - * @memberof TextUtils + * @param text contents of plain text object + * @returns TextField */ - public static makePlainText(text: string): TextField; + function makePlainText(text: string): TextField; /** * Creates a rich TextField object with contents : text - * - * @static - * @param {string} text - * @returns - * @memberof TextUtils + * @param text text + * @returns TextField */ - public static makeRichText(text: string): TextField; + function makeRichText(text: string): TextField; /** * Creates a textContent - * - * @static - * @param {{type : string, text : string}} primaryText - * @param {{type : string, text : string}} secondaryText - * @param {{type : string, text : string}} tertiaryText - * @returns - * @memberof TextUtils + * @param primaryText primary Text + * @param secondaryText secondary Text + * @param tertiaryText tertiary Text + * @returns TextContent */ - public static makeTextContent(primaryText: { type: string, text: string }, - secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent + function makeTextContent(primaryText: { type: string, text: string }, + secondaryText: { type: string, text: string }, tertiaryText: { type: string, text: string }): TextContent; } } //#endregion