UNPKG

homey-api

Version:
99 lines (84 loc) 2.03 kB
'use strict'; const Manager = require('./Manager'); const Flow = require('./ManagerFlow/Flow'); const AdvancedFlow = require('./ManagerFlow/AdvancedFlow'); const FlowCardTrigger = require('./ManagerFlow/FlowCardTrigger'); const FlowCardCondition = require('./ManagerFlow/FlowCardCondition'); const FlowCardAction = require('./ManagerFlow/FlowCardAction'); class ManagerFlow extends Manager { static CRUD = { ...super.CRUD, Flow, AdvancedFlow, FlowCardTrigger, FlowCardCondition, FlowCardAction, } async getFlowCardTrigger({ $cache = true, id, }) { if ($cache === true && this.__cache['flowcardtrigger'][id]) { return this.__cache['flowcardtrigger'][id]; } return this.__super__getFlowCardTrigger({ id: id, uri: id.split(':', 3).join(':'), }); } async getFlowCardCondition({ $cache = true, id, }) { if ($cache === true && this.__cache['flowcardcondition'][id]) { return this.__cache['flowcardcondition'][id]; } return this.__super__getFlowCardCondition({ id: id, uri: id.split(':', 3).join(':'), }); } async runFlowCardCondition({ id, ...props }) { return this.__super__runFlowCardCondition({ id: id, uri: id.split(':', 3).join(':'), ...props, }); } async getFlowCardAction({ $cache = true, id, }) { if ($cache === true && this.__cache['flowcardaction'][id]) { return this.__cache['flowcardaction'][id]; } return this.__super__getFlowCardAction({ id: id, uri: id.split(':', 3).join(':'), }); } async runFlowCardAction({ id, ...props }) { return this.__super__runFlowCardAction({ id: id, uri: id.split(':', 3).join(':'), ...props, }); } async getFlowCardAutocomplete({ id, ...props }) { return this.__super__getFlowCardAutocomplete({ id: id, uri: id.split(':', 3).join(':'), ...props, }); } } module.exports = ManagerFlow;