export type GetApiIntelligenceSenderHealthSummaryArgs = {teamId: string, windowDays?: number | undefined}; export type GetApiIntelligenceSenderHealthSummaryOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sender Health Summary * * GET /intelligence/sender-health-summary */ export const getApiIntelligenceSenderHealthSummary = async (args: GetApiIntelligenceSenderHealthSummaryArgs, options?: GetApiIntelligenceSenderHealthSummaryOptions) => { const {baseUrl = "https://api.supersend.io/v2", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.teamId != null) query.append("teamId", String(args.teamId)) if (args.windowDays != null) query.append("windowDays", String(args.windowDays)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/intelligence/sender-health-summary${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 };