export type Comment = {comment?: string | undefined}; export type CreateApiRunsRunActionsForceArgs = {run: string, body: Comment}; export type CreateApiRunsRunActionsForceOptions = {baseUrl?: string | undefined, APIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Force Run * * POST /runs/{run}/actions/force */ export const createApiRunsRunActionsForce = async (args: CreateApiRunsRunActionsForceArgs, options?: CreateApiRunsRunActionsForceOptions) => { const {baseUrl = "https://example.scalr.io/api/iacp/v3", fetch: fetchFn = fetch, APIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKey !== undefined) headers.set('authorization', `Bearer ${APIKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/runs/${encodeURIComponent(String(args.run))}/actions/force${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 };