function DillerRpc($http, DillerConfig) { var baseUrl = DillerConfig.baseUrl; function getDevices() { var req = {}; req.method = 'get'; req.url = baseUrl + '/api/device'; return $http(req); } function getDevice(deviceId) { var req = {}; req.method = 'get'; req.url = baseUrl + '/api/device/:deviceId'; req.url = req.url.replace(/:deviceId/, deviceId); return $http(req); } function patchDevice(deviceId, payload) { var req = {}; req.method = 'patch'; req.url = baseUrl + '/api/device/:deviceId'; req.url = req.url.replace(/:deviceId/, deviceId); req.data = payload; return $http(req); } function getValues(propertyId) { var req = {}; req.method = 'get'; req.url = baseUrl + '/api/property/:propertyId/values'; req.url = req.url.replace(/:propertyId/, propertyId); return $http(req); } return { getDevices: getDevices, getDevice: getDevice, patchDevice: patchDevice, getValues: getValues }; } DillerRpcResolve = {}; DillerRpcResolve.getDevices = function(DillerRpc) { return DillerRpc.getDevices(); }; DillerRpcResolve.getDevice = function(DillerRpc, $route) { return DillerRpc.getDevice($route.current.params.deviceId); }; DillerRpcResolve.patchDevice = function(DillerRpc, $route) { return DillerRpc.patchDevice($route.current.params.deviceId, $route.current.params.payload); }; DillerRpcResolve.getValues = function(DillerRpc, $route) { return DillerRpc.getValues($route.current.params.propertyId); };