import BaseApi from "./base"; class SystemApi extends BaseApi { constructor() { super("/system"); } private async performAction(action: string) { await this.post("", undefined, { action }); } async login(username: string, password: string) { await this.post("/account", { username, password }, { action: "login" }); } async logout() { await this.post("/account", undefined, { action: "logout" }); } async shutdown() { return this.performAction("shutdown"); } async restart() { return this.performAction("restart"); } async settings() { const response = await this.get("/settings"); return response; } async updateSettings(data: object) { await this.post("/settings", data); } async languages(history = false) { const response = await this.get("/languages", { history, }); return response; } async languagesProfileList() { const response = await this.get("/languages/profiles"); return response; } async status() { const response = await this.get>("/status"); return response.data; } async backups() { const response = await this.get>("/backups"); return response.data; } async createBackups() { await this.post("/backups"); } async restoreBackups(filename: string) { await this.patch("/backups", { filename }); } async deleteBackups(filename: string) { await this.delete("/backups", { filename }); } async health() { const response = await this.get>("/health"); return response.data; } async logs() { const response = await this.get>("/logs"); return response.data; } async releases() { const response = await this.get>("/releases"); return response.data; } async deleteLogs() { await this.delete("/logs"); } async tasks() { const response = await this.get>("/tasks"); return response.data; } async runTask(taskid: string) { await this.post("/tasks", { taskid }); } async testNotification(url: string) { await this.patch("/notifications", { url }); } async search(query: string) { const response = await this.get("/searches", { query }); return response; } } export default new SystemApi();