export type GetApiAdminFunnelfoxLtvIapCountryBreakdownArgs = {cacheDays: string}; export type GetApiAdminFunnelfoxLtvIapCountryBreakdownOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get FunnelFox country distribution with server cache * * GET /admin/funnelfox-ltv/iap-country-breakdown */ export const getApiAdminFunnelfoxLtvIapCountryBreakdown = async (args: GetApiAdminFunnelfoxLtvIapCountryBreakdownArgs, options: GetApiAdminFunnelfoxLtvIapCountryBreakdownOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cacheDays != null) query.append("cacheDays", String(args.cacheDays)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/admin/funnelfox-ltv/iap-country-breakdown${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 };