export type GetApiApiTrackerV1LogArgs = {app_id: string, event_ids: number, server_time_min?: string | undefined, server_time_max?: string | undefined}; export type GetApiApiTrackerV1LogOptions = {baseUrl?: string | undefined, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Logs * * GET /api/tracker/v1/log */ export const getApiApiTrackerV1Log = async (args: GetApiApiTrackerV1LogArgs, options?: GetApiApiTrackerV1LogOptions) => { const {baseUrl = "https://example.piwik.pro", fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/x-ndjson") if (args.app_id != null) query.append("app_id", String(args.app_id)) if (args.event_ids != null) query.append("event_ids", String(args.event_ids)) if (args.server_time_min != null) query.append("server_time_min", String(args.server_time_min)) if (args.server_time_max != null) query.append("server_time_max", String(args.server_time_max)) if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/tracker/v1/log${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 res.blob() };