export type MinionRename = {name: string}; export type UpdateApiMinionsRenameMinionIdArgs = {minionId: string, body: MinionRename}; export type UpdateApiMinionsRenameMinionIdOptions = {baseUrl: string, userAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update minion name. * * PUT /minions/rename/{minionId} * * Also accepts auth: adminAuth */ export const updateApiMinionsRenameMinionId = async (args: UpdateApiMinionsRenameMinionIdArgs, options: UpdateApiMinionsRenameMinionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, userAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (userAuth !== undefined) headers.set("authentication", userAuth) const url = `${baseUrl.replace(/\/+$/, '')}/minions/rename/${encodeURIComponent(String(args.minionId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };