export type UpdateApiActionsSetActiveActionIdArgs = {actionId: string, active: boolean}; export type UpdateApiActionsSetActiveActionIdOptions = {baseUrl: string, userAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set action active mode * * PUT /actions/set-active/{actionId} * * Also accepts auth: adminAuth */ export const updateApiActionsSetActiveActionId = async (args: UpdateApiActionsSetActiveActionIdArgs, options: UpdateApiActionsSetActiveActionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, userAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.active != null) query.append("active", String(args.active)) if (userAuth !== undefined) headers.set("authentication", userAuth) const url = `${baseUrl.replace(/\/+$/, '')}/actions/set-active/${encodeURIComponent(String(args.actionId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };