forked from bisand/net.biseth.myenergi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.ts
26 lines (19 loc) · 874 Bytes
/
api.ts
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
import Homey from 'homey/lib/Homey';
import { MyEnergiApp } from './app';
module.exports = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async postLogin(data: { homey: Homey, body: any }) {
const app = data.homey.app as MyEnergiApp;
const response = await app.validateCredentials(data.body).catch(this.error);
console.log(response);
return (response);
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
async getTest(data: { homey: Homey, query: any }) {
// you can access query parameters like "/?foo=bar" through `query.foo`
// you can access the App instance through homey.app
const result = [{ test: "test1" }, { test: "test2" }];
// perform other logic like mapping result data
return result;
}
}