export type GetApiNessiePipelineJobsArgs = {project_id: number}; export type GetApiNessiePipelineJobsOptions = {baseUrl?: string | undefined, ServiceAccount?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * List Pipelines * * GET /nessie/pipeline/jobs * * Also accepts auth: ProjectSecret */ export const getApiNessiePipelineJobs = async (args: GetApiNessiePipelineJobsArgs, options?: GetApiNessiePipelineJobsOptions) => { const {baseUrl = "https://mixpanel.com/api/query", fetch: fetchFn = fetch, ServiceAccount} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.project_id != null) query.append("project_id", String(args.project_id)) if (ServiceAccount !== undefined) headers.set('authorization', `Basic ${btoa(`${ServiceAccount.username}:${ServiceAccount.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/nessie/pipeline/jobs${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 (await res.json()) as unknown };