-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Alerts.ts
57 lines (52 loc) · 2.1 KB
/
Alerts.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { BaseSubObject } from '../BaseSubObject.js';
import { Alerts as AlertsTypes } from '../types/index.js';
import { AxiosResponse } from 'axios';
export class Alerts extends BaseSubObject {
/**
* Create Alerts and return the IDs
* @param datas
*/
public async pushAlerts(datas: AlertsTypes.PushAlerts.RequestBody): Promise<AlertsTypes.PushAlerts.ResponseBody> {
return (
await this.http.post<
AlertsTypes.PushAlerts.ResponseBody,
AxiosResponse<AlertsTypes.PushAlerts.ResponseBody>,
AlertsTypes.PushAlerts.RequestBody
>('/v1/alerts', datas)
).data;
}
public async search(options?: AlertsTypes.SearchAlerts.RequestQuery): Promise<AlertsTypes.SearchAlerts.ResponseBody> {
return (
await this.http.get<
AlertsTypes.SearchAlerts.ResponseBody,
AxiosResponse<AlertsTypes.SearchAlerts.ResponseBody>,
AlertsTypes.SearchAlerts.RequestQuery
>('/v1/alerts', {
params: options
})
).data;
}
public async getById(id: string): Promise<AlertsTypes.SearchAlerts.ResponseBody> {
return (
await this.http.get<
AlertsTypes.SearchAlerts.ResponseBody,
AxiosResponse<AlertsTypes.SearchAlerts.ResponseBody>,
AlertsTypes.SearchAlerts.RequestQuery
>(`/v1/alerts/${id}`)
).data;
}
public async delete(options: AlertsTypes.DeleteAlerts.RequestQuery): Promise<AlertsTypes.DeleteAlerts.ResponseBody> {
return (
await this.http.delete<
AlertsTypes.DeleteAlerts.ResponseBody,
AxiosResponse<AlertsTypes.DeleteAlerts.ResponseBody>,
AlertsTypes.DeleteAlerts.RequestQuery
>('/v1/alerts', {
data: options
})
).data;
}
public async deleteById(id: string): Promise<AlertsTypes.DeleteAlerts.ResponseBody> {
return (await this.http.delete<AlertsTypes.DeleteAlerts.ResponseBody>(`/v1/alerts/${id}`)).data;
}
}