export type SystemPluginsReloadBackendRequest = {mounts?: Array | undefined, plugin?: string | undefined, scope?: string | undefined}; export type CreateApiSysPluginsReloadBackendArgs = {body: SystemPluginsReloadBackendRequest}; export type CreateApiSysPluginsReloadBackendOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Reload mounted plugin backends. * * POST /sys/plugins/reload/backend */ export const createApiSysPluginsReloadBackend = async (args: CreateApiSysPluginsReloadBackendArgs, options: CreateApiSysPluginsReloadBackendOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/sys/plugins/reload/backend${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };