export type GetApiV1JobsJobIdActivityEventsArgs = {job_id: string, 'last-event-id'?: (string | null) | undefined}; export type GetApiV1JobsJobIdActivityEventsOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * stream_job_activity * * GET /v1/jobs/{job_id}/activity/events */ export const getApiV1JobsJobIdActivityEvents = async (args: GetApiV1JobsJobIdActivityEventsArgs, options?: GetApiV1JobsJobIdActivityEventsOptions) => { const {baseUrl = "https://ndi-api.nace.ai", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['last-event-id'] != null) headers.set("last-event-id", String(args['last-event-id'])) if (APIKeyHeader !== undefined) headers.set("X-API-Key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v1/jobs/${encodeURIComponent(String(args.job_id))}/activity/events${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 };