export type ReportTeamStatsDto = {userIds: Array, startDate: string, endDate: string, countBy: 'relative' | 'absolute', limit: number, page: number, sortOrder: 'asc' | 'desc', orderBy: 'prospectAdded' | 'prospectContacted' | 'opened' | 'clicked' | 'replied' | 'unSubscribed' | 'bounced' | 'Uncategorized' | 'Interested' | 'Not Interested' | 'Meeting Booked' | 'Out of Office' | 'Closed' | 'Not Now' | 'Do Not Contact' | 'prospectContacted' | 'emailSent' | 'opened' | 'clicked' | 'replied' | 'bounced', type: 'prospect' | 'email'}; export type CreateApiV1AnalyticsTeamStatsArgs = {body: ReportTeamStatsDto}; export type CreateApiV1AnalyticsTeamStatsOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Stats team(s) report * * POST /v1/analytics/team/stats */ export const createApiV1AnalyticsTeamStats = async (args: CreateApiV1AnalyticsTeamStatsArgs, options: CreateApiV1AnalyticsTeamStatsOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/analytics/team/stats${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };