export type Properties = Record; export type Model148 = {email?: string | undefined, mobile?: string | undefined, uniqueId?: string | undefined, variables?: Properties | undefined}; export type Model149 = Array; export type GetContactSchema = Array; export type Model191 = {contacts?: Model149 | undefined, name?: string | undefined, contactLists?: GetContactSchema | undefined, sendLaterInDays?: number | undefined, customProperties?: Properties | undefined}; export type CreateApiV1CesSurveyIdEmailChannelIdArgs = {survey_id: number, channel_id: number, body: Model191}; export type CreateApiV1CesSurveyIdEmailChannelIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send CES channel Blast * * POST /v1/ces/{survey_id}/email/{channel_id} */ export const createApiV1CesSurveyIdEmailChannelId = async (args: CreateApiV1CesSurveyIdEmailChannelIdArgs, options?: CreateApiV1CesSurveyIdEmailChannelIdOptions) => { const {baseUrl = "https://api.surveysparrow.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v1/ces/${encodeURIComponent(String(args.survey_id))}/email/${encodeURIComponent(String(args.channel_id))}${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 res.blob() };