@corux/ask-extensions
Version:
Extensions to improve development with Alexa Skills Kit SDK
32 lines (31 loc) • 1.67 kB
TypeScript
import { ResponseBuilder } from "ask-sdk-core";
import { Directive, interfaces, RequestEnvelope, ui } from "ask-sdk-model";
import { IExtendedHandlerInput } from "./ExtendedHandlerInput";
export interface IExtendedResponseBuilder extends ResponseBuilder {
/**
* Conditionally executes methods on the builder.
* @param condition Condition to check. If true, the callback will be executed on the builder.
* @param callback Code to run on the builder.
*/
if(condition: ((request: RequestEnvelope) => boolean) | boolean, callback: (builder: ResponseBuilder) => void): IExtendedResponseBuilder;
/**
* Adds the speech output, if it is allowed, i.e. the current request is not of type "PlaybackController".
*/
speakIfSupported(speechOutput: string, playBehavior?: ui.PlayBehavior): IExtendedResponseBuilder;
/**
* Adds the render template, if the Display interface is supported by the current request.
* @param template The render template to add.
*/
addRenderTemplateDirectiveIfSupported(template: interfaces.display.Template): IExtendedResponseBuilder;
/**
* Adds the hint, if the Display interface is supported by the current request.
* @param template The hint to add.
*/
addHintDirectiveIfSupported(text: string): IExtendedResponseBuilder;
/**
* Adds the directive, if the APL interface is supported by the current request.
* @param directive The directive to add.
*/
addAplDirectiveIfSupported(directive: Directive): IExtendedResponseBuilder;
}
export declare function getResponseBuilder(handlerInput: IExtendedHandlerInput): IExtendedResponseBuilder;