From 8cce087c1f39933589d98a2137ebaafc1f721e8b Mon Sep 17 00:00:00 2001 From: hexxa Date: Sat, 9 Oct 2021 17:01:54 +0800 Subject: [PATCH] feat(client/web): add settings ts client --- src/client/web/src/client/settings.ts | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/client/web/src/client/settings.ts diff --git a/src/client/web/src/client/settings.ts b/src/client/web/src/client/settings.ts new file mode 100644 index 0000000..43f0b84 --- /dev/null +++ b/src/client/web/src/client/settings.ts @@ -0,0 +1,31 @@ +import { BaseClient, Response, userIDParam, Quota } from "."; + +import { ClientConfig } from "./"; + +export class SettingsClient extends BaseClient { + constructor(url: string) { + super(url); + } + + health = (): Promise => { + return this.do({ + method: "get", + url: `${this.url}/v1/settings/health`, + }); + }; + + getClientCfg = (): Promise => { + return this.do({ + method: "get", + url: `${this.url}/v1/settings/client`, + }); + }; + + setClientCfg = (cfg: ClientConfig): Promise => { + return this.do({ + method: "patch", + url: `${this.url}/v1/settings/client`, + data: cfg, + }); + }; +}