export type GetApiHubWorkflowsErroredArgs = {flow_subject?: string | undefined}; export type GetApiHubWorkflowsErroredOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List errored workflow runs * * GET /hub/workflows/errored * * Also accepts auth: apiKeyAuth */ export const getApiHubWorkflowsErrored = async (args: GetApiHubWorkflowsErroredArgs, options?: GetApiHubWorkflowsErroredOptions) => { const {baseUrl = "https://api.quiva.ai", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.flow_subject != null) query.append("flow_subject", String(args.flow_subject)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/hub/workflows/errored${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };