export type GetApiV1WorkflowsIdExecutionsArgs = {id: string, limit?: (number | null) | undefined, offset?: (number | null) | undefined, sortBy?: (string | null) | undefined, sortDirection?: (string | null) | undefined, status?: (Array | null) | undefined, startDate?: (string | null) | undefined, endDate?: (string | null) | undefined, search?: (string | null) | undefined}; export type GetApiV1WorkflowsIdExecutionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List Workflow Executions * * GET /v1/workflows/{id}/executions */ export const getApiV1WorkflowsIdExecutions = async (args: GetApiV1WorkflowsIdExecutionsArgs, options?: GetApiV1WorkflowsIdExecutionsOptions) => { const {baseUrl = "https://api.sandbox.usenash.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.sortBy != null) query.append("sortBy", String(args.sortBy)) if (args.sortDirection != null) query.append("sortDirection", String(args.sortDirection)) for (const item of args.status ?? []) query.append("status", String(item)) if (args.startDate != null) query.append("startDate", String(args.startDate)) if (args.endDate != null) query.append("endDate", String(args.endDate)) if (args.search != null) query.append("search", String(args.search)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workflows/${encodeURIComponent(String(args.id))}/executions${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 };