export type CustomerIoWeeklyInsightReportEventBodyDto = {userId: number}; export type CreateApiV1CustomerIoWebhookEventsWeeklyInsightReportArgs = {body: CustomerIoWeeklyInsightReportEventBodyDto}; export type CreateApiV1CustomerIoWebhookEventsWeeklyInsightReportOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /v1/customer-io/webhook/events/weekly-insight-report */ export const createApiV1CustomerIoWebhookEventsWeeklyInsightReport = async (args: CreateApiV1CustomerIoWebhookEventsWeeklyInsightReportArgs, options: CreateApiV1CustomerIoWebhookEventsWeeklyInsightReportOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/customer-io/webhook/events/weekly-insight-report${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 };