import { http } from './http' import type { StatusResponse, ProxyListResp, ProxyDefinition, VisitorListResp, VisitorDefinition, } from '../types/proxy' export const getStatus = () => { return http.get('/api/status') } export const getConfig = () => { return http.get('/api/config') } export const putConfig = (content: string) => { return http.put('/api/config', content) } export const reloadConfig = () => { return http.get('/api/reload') } // Store API - Proxies export const listStoreProxies = () => { return http.get('/api/store/proxies') } export const getStoreProxy = (name: string) => { return http.get( `/api/store/proxies/${encodeURIComponent(name)}`, ) } export const createStoreProxy = (config: ProxyDefinition) => { return http.post('/api/store/proxies', config) } export const updateStoreProxy = (name: string, config: ProxyDefinition) => { return http.put( `/api/store/proxies/${encodeURIComponent(name)}`, config, ) } export const deleteStoreProxy = (name: string) => { return http.delete(`/api/store/proxies/${encodeURIComponent(name)}`) } // Store API - Visitors export const listStoreVisitors = () => { return http.get('/api/store/visitors') } export const getStoreVisitor = (name: string) => { return http.get( `/api/store/visitors/${encodeURIComponent(name)}`, ) } export const createStoreVisitor = (config: VisitorDefinition) => { return http.post('/api/store/visitors', config) } export const updateStoreVisitor = ( name: string, config: VisitorDefinition, ) => { return http.put( `/api/store/visitors/${encodeURIComponent(name)}`, config, ) } export const deleteStoreVisitor = (name: string) => { return http.delete(`/api/store/visitors/${encodeURIComponent(name)}`) }