export type GetApiNessiePipelineTimelineArgs = {project_id: number, name?: string | undefined}; export type GetApiNessiePipelineTimelineOptions = {baseUrl?: string | undefined, ServiceAccount?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * List Pipeline Logs * * GET /nessie/pipeline/timeline * * Also accepts auth: ProjectSecret */ export const getApiNessiePipelineTimeline = async (args: GetApiNessiePipelineTimelineArgs, options?: GetApiNessiePipelineTimelineOptions) => { 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 (args.name != null) query.append("name", String(args.name)) if (ServiceAccount !== undefined) headers.set('authorization', `Basic ${btoa(`${ServiceAccount.username}:${ServiceAccount.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/nessie/pipeline/timeline${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 };