export type FactoryEnable = {hold_workers?: boolean | undefined}; export type CreateApi0AdminFactoryFactoryEnableArgs = {factory: string, body: FactoryEnable}; export type CreateApi0AdminFactoryFactoryEnableOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /0/admin/factory/{factory}/enable */ export const createApi0AdminFactoryFactoryEnable = async (args: CreateApi0AdminFactoryFactoryEnableArgs, options: CreateApi0AdminFactoryFactoryEnableOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/0/admin/factory/${encodeURIComponent(String(args.factory))}/enable${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 };