Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public handle(handlerInput : HandlerInput) : Response {
const speechText = 'Hello World!';
const attributes = handlerInput.attributesManager.getSessionAttributes();
attributes.foo = 'bar';
attributes.count = 1;
handlerInput.attributesManager.setSessionAttributes(attributes);
return handlerInput.responseBuilder
.speak(speechText)
.withSimpleCard('Hello World', speechText)
.getResponse();
}
}
export const handler : LambdaHandler = SkillBuilders.custom()
.addRequestHandlers(
new LaunchRequestHandler(),
new HelloWorldIntentHandler(),
)
.lambda();
try {
const name = await upsServiceClient.getProfileName();
const givenName = await upsServiceClient.getProfileGivenName();
const email = await upsServiceClient.getProfileEmail();
const mobile = await upsServiceClient.getProfileMobileNumber();
const speechText = `Hello, ${givenName} ${name}. Your e-mail is ${email} and your phone number is ${mobile}`;
return handlerInput.responseBuilder.speak(speechText).getResponse();
} catch (e) {
return handlerInput.responseBuilder.speak('Hello, world! I am not allowed to view your profile.').getResponse();
}
}
}
export const handler : LambdaHandler = SkillBuilders.custom()
.addRequestHandlers(
new LaunchRequestHandler(),
)
.withApiClient(new DefaultApiClient())
.lambda();
|| (handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'HelloWorldIntent');
}
public handle(handlerInput : HandlerInput) : Response {
const speech = ['Hello, how are you?', 'Hi, what\'s up?', 'Good day, how are you doing?'];
const reprompt = ['How are you?', 'How do you feel?'];
return handlerInput.responseBuilder
.speak(speech[Math.floor(Math.random() * speech.length)])
.reprompt(reprompt[Math.floor(Math.random() * reprompt.length)])
.getResponse();
}
}
export const handler : LambdaHandler = SkillBuilders.custom()
.addRequestHandlers(
new LaunchRequestHandler(),
)
.lambda();
class ResumeIntentHandler implements RequestHandler {
public canHandle(handlerInput : HandlerInput) : boolean {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.ResumeIntent';
}
public handle(handlerInput : HandlerInput) : Response {
const offset = handlerInput.requestEnvelope.context.AudioPlayer ? handlerInput.requestEnvelope.context.AudioPlayer.offsetInMilliseconds || 0 : 0;
return handlerInput.responseBuilder
.addAudioPlayerPlayDirective('REPLACE_ALL', 'https://superAudio.stream', 'superToken', offset, 'superToken')
.getResponse();
}
}
export const handler : LambdaHandler = SkillBuilders.custom()
.addRequestHandlers(
new LaunchRequestHandler(),
new PlayStreamIntentHandler(),
new ClearQueueIntentHandler(),
new StopAudioHandler(),
new ResumeIntentHandler(),
)
.lambda();
}
class SayGoodbyeHandler implements RequestHandler {
public canHandle(handlerInput : HandlerInput) : boolean {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'SayGoodbye';
}
public async handle(handlerInput : HandlerInput) : Promise {
const attributes = await handlerInput.attributesManager.getPersistentAttributes();
return handlerInput.responseBuilder.speak(`Bye ${attributes.foo}!`).getResponse();
}
}
export const handler : LambdaHandler = SkillBuilders.custom()
.withPersistenceAdapter(new DynamoDbPersistenceAdapter({
tableName: 'TestTable',
partitionKeyName: 'userId',
attributesName: 'mapAttr',
}))
.withApiClient(new DefaultApiClient())
.addRequestHandlers(
new SayHelloHandler(),
new SayGoodbyeHandler(),
)
.lambda();
function EmitEvent() : void {
const packageInfo = require('../package.json');
this.state = this._event.session.attributes.STATE || '';
SkillBuilders.custom()
.addRequestHandlers(new Handler(this), ...this.v2RequestHandlers)
.addRequestInterceptors(new CopySessionAttributesInterceptor())
.withPersistenceAdapter(dynamoDbPersistenceAdapter)
.withApiClient(new DefaultApiClient())
.withCustomUserAgent(`${packageInfo.name}/${packageInfo.version}`)
.create()
.invoke(this._event, this._context)
.then((responseEnvelope) => {
if (typeof this._callback === 'undefined') {
this._context.succeed(responseEnvelope);
} else {
this._callback(null, responseEnvelope);
}
})
.catch((err) => {
if (typeof this._callback === 'undefined') {