import { BaseAPI, route } from "../base"; import { NotifierCreate, NotifierOut, NotifierUpdate } from "../types/data-contracts"; export class NotifiersAPI extends BaseAPI { getAll() { return this.http.get({ url: route("/notifiers") }); } create(body: NotifierCreate) { return this.http.post({ url: route("/notifiers"), body }); } update(id: string, body: NotifierUpdate) { if (body.url === "") { body.url = null; } return this.http.put({ url: route(`/notifiers/${id}`), body }); } delete(id: string) { return this.http.delete({ url: route(`/notifiers/${id}`) }); } test(url: string) { return this.http.post<{ url: string }, null>({ url: route(`/notifiers/test`), body: { url } }); } }