-
Notifications
You must be signed in to change notification settings - Fork 1
/
service.js
41 lines (36 loc) · 1.82 KB
/
service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// enables strict mode which helps catch common JS programming blunders
'use strict'
var APP_ID = 'amzn1.ask.skill.6b80bb3f-2eba-4afa-b4b8-c5c88f6c145c'
var AlexaSkill = require('./alexa-skill')
var LaunchIntentFunction = require('./intents/launch-intent-function.js')
var GeneralJobsFunction = require('./intents/general-jobs-intent-function.js')
var LocationIntentFunction = require('./intents/location-intent-function')
var LevelIntentFunction = require('./intents/level-intent-function.js')
var CategoryIntentFunction = require('./intents/category-intent-function.js')
var HelpIntentFunction = require('./intents/help-intent-function.js')
var StopIntentFunction = require('./intents/stop-intent-function.js')
var CancelIntentFunction = require('./intents/cancel-intent-function.js')
// Define a MuseJobsService function which inherits from AlexaSkill.js class
var MuseJobsService = function () {
AlexaSkill.call(this, APP_ID)
}
MuseJobsService.prototype = Object.create(AlexaSkill.prototype)
// this will be invoked when the user first launches or opens the skill with its invocation name
// this is triggered when said "Alexa, ask muse jobs"
MuseJobsService.prototype.eventHandlers.onLaunch = LaunchIntentFunction
// How Alexa knows to handle all the different functions
// Each intent corresponds to a function
// That function is called when that intent is invoked
MuseJobsService.prototype.intentHandlers = {
'GeneralJobsIntent': GeneralJobsFunction,
'LocationIntent': LocationIntentFunction,
'LevelIntent': LevelIntentFunction,
'CategoryIntent': CategoryIntentFunction,
'AMAZON.HelpIntent': HelpIntentFunction,
'AMAZON.StopIntent': StopIntentFunction,
'AMAZON.CancelIntent': CancelIntentFunction
}
exports.handler = function (event, context) {
var museJobsService = new MuseJobsService()
museJobsService.execute(event, context)
}