export type GetApiExperimentsCteVariationArgs = {'X-API-Key': string, start_date?: string | undefined, end_date?: string | undefined, brand?: string | undefined, limit?: number | undefined, sample_count?: number | undefined}; export type GetApiExperimentsCteVariationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get top call-to-emotion (CTE) variations used in notifications. * * GET /experiments/cte-variation */ export const getApiExperimentsCteVariation = async (args: GetApiExperimentsCteVariationArgs, options?: GetApiExperimentsCteVariationOptions) => { const {baseUrl = "https://api.notiflow.empushy.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) if (args.start_date != null) query.append("start_date", String(args.start_date)) if (args.end_date != null) query.append("end_date", String(args.end_date)) if (args.brand != null) query.append("brand", String(args.brand)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.sample_count != null) query.append("sample_count", String(args.sample_count)) const url = `${baseUrl.replace(/\/+$/, '')}/experiments/cte-variation${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 (await res.json()) as unknown };