export type CreateApiPluginsPlaybooksApiV0RunsIdOwnerArgs = {id: string, body: {owner_id: string}}; export type CreateApiPluginsPlaybooksApiV0RunsIdOwnerOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update playbook run owner * * POST /plugins/playbooks/api/v0/runs/{id}/owner */ export const createApiPluginsPlaybooksApiV0RunsIdOwner = async (args: CreateApiPluginsPlaybooksApiV0RunsIdOwnerArgs, options?: CreateApiPluginsPlaybooksApiV0RunsIdOwnerOptions) => { const {baseUrl = "http://localhost:8065/plugins/playbooks/api/v0", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/plugins/playbooks/api/v0/runs/${encodeURIComponent(String(args.id))}/owner${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 };