-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathapi.ts
31 lines (25 loc) · 938 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
26
27
28
29
30
31
'use strict';
import { ApiSettings } from './assets/publicTypes';
import { TrashCollectionReminder } from './types/localTypes';
module.exports = {
async trashCollectionDays({ homey, query }: { homey: any; query: any }) {
const app = <TrashCollectionReminder>homey.app;
if (query.recalculate === 'true') {
app.log('Recalculation started.');
await app.recalculate();
}
return app.collectionDates;
},
async validateUserData({ homey, body }: { homey: any; body: ApiSettings }) {
console.log(body);
const app = <TrashCollectionReminder>homey.app;
const apiFindResult = await app.trashApis.FindApi(body);
return apiFindResult;
},
async validateUserCleanData({ homey, body }: { homey: any; body: ApiSettings }) {
console.log(body);
const app = <TrashCollectionReminder>homey.app;
const cleanApiResult = await app.cleanApis.FindApi(body);
return cleanApiResult;
},
};