export type GetApiActivityLogArgs = {start: string, end: string, actions?: string | undefined, requestId?: string | undefined, customerId?: string | undefined, externalCustomerId?: string | undefined, connectionIds?: string | undefined, financialAccountIds?: string | undefined, eventType?: string | undefined, before?: string | undefined, after?: string | undefined, limit?: number | undefined}; export type GetApiActivityLogOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search activity log * * GET /activity-log */ export const getApiActivityLog = async (args: GetApiActivityLogArgs, options?: GetApiActivityLogOptions) => { const {baseUrl = "https://api-sb.meld.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.start != null) query.append("start", String(args.start)) if (args.end != null) query.append("end", String(args.end)) if (args.actions != null) query.append("actions", String(args.actions)) if (args.requestId != null) query.append("requestId", String(args.requestId)) if (args.customerId != null) query.append("customerId", String(args.customerId)) if (args.externalCustomerId != null) query.append("externalCustomerId", String(args.externalCustomerId)) if (args.connectionIds != null) query.append("connectionIds", String(args.connectionIds)) if (args.financialAccountIds != null) query.append("financialAccountIds", String(args.financialAccountIds)) if (args.eventType != null) query.append("eventType", String(args.eventType)) if (args.before != null) query.append("before", String(args.before)) if (args.after != null) query.append("after", String(args.after)) if (args.limit != null) query.append("limit", String(args.limit)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/activity-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() };