initial release of Alex2Node
This commit is contained in:
parent
0804bd7397
commit
4eb2a84d72
20 changed files with 2047 additions and 3 deletions
41
src/ActionMapping.ts
Normal file
41
src/ActionMapping.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
export enum AlexaActions {
|
||||
Open = "Alexa.Actions.Open",
|
||||
Close = "Alexa.Actions.Close",
|
||||
Raise = "Alexa.Actions.Raise",
|
||||
Lower = "Alexa.Actions.Lower",
|
||||
SetEcoOn = "Alexa.Actions.SetEcoOn",
|
||||
SetEcoOff = "Alexa.Actions.SetEcoOff",
|
||||
}
|
||||
|
||||
interface Directive {
|
||||
name: string;
|
||||
payload?: string;
|
||||
}
|
||||
|
||||
export class ActionMapping {
|
||||
type: string = "ActionsToDirective";
|
||||
actions: AlexaActions[];
|
||||
directive: Directive;
|
||||
|
||||
constructor(
|
||||
actions: AlexaActions[],
|
||||
directiveName: string,
|
||||
directivePayload: string | undefined
|
||||
) {
|
||||
this.actions = actions;
|
||||
this.directive = {
|
||||
name: directiveName,
|
||||
};
|
||||
if (directivePayload) {
|
||||
this.directive.payload = directivePayload;
|
||||
}
|
||||
}
|
||||
|
||||
toJSON(): object {
|
||||
return {
|
||||
"@type": this.type,
|
||||
actions: this.actions,
|
||||
directive: this.directive,
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue