import axios from 'axios'; import { PbmStats } from "../types/pbm_stats"; import { Button } from "../types/button"; import { LayerKey } from "../types/layer_key"; import { ButtonsSettingType } from "../types/buttons_setting_type"; interface DirPathApiResponse { result: string, root_path: string, } interface SettingPathApiResponse { result: string, setting_path: string, } interface PostApiResponse { result: string, } interface StatsApiResponse { stats: PbmStats, result: string, pid: number | null, } export interface SettingApiResponse { result: string, setting: ButtonsSettingType, setting_group_by_button: any, installed_macros: Array, installed_modes: Array, } interface SettingDigestApiResponse { result: string, digest: string, } export class HttpClient { constructor() { }; getDirPath() { const path = "/api/pbm_root__path"; return axios.get(`/api/pbm_root_path`); } postDirPath(dirPath: string) { return axios.post(`/api/pbm_root_path`, { root_path: dirPath }); } getSettingPath() { return axios.get( "/api/pbm_setting_path"); } postSettingPath(settingPath: string) { const path = "/api/pbm_setting_path" return axios.post(`${path}`, { setting_path: settingPath }); } getPbmStats() { const path = "/api/pbm_stats"; return axios.get(`${path}`); } startPbm() { const path = "/api/start_pbm"; return axios.post(`${path}`); } stopPbm() { const path = "/api/stop_pbm"; return axios.post(`${path}`); } reloadPbmSetting() { const path = "/api/reload_pbm_setting"; return axios.post(`${path}`); } getSetting() { return axios.get("/api/pbm_setting"); } postSetting(settingYaml: string) { return axios.post("/api/pbm_setting", { setting_yaml: settingYaml }); } getSettingDigest() { return axios.get("/api/pbm_setting_digest"); } }