export type UnsubscribeParamsDto = {emails: Array}; export type CreateApiApiV1EmailsUnsubscribedDeleteArgs = {body: UnsubscribeParamsDto}; export type CreateApiApiV1EmailsUnsubscribedDeleteOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Remove emails from unsubscribed list * * POST /api/v1/emails/unsubscribed/delete */ export const createApiApiV1EmailsUnsubscribedDelete = async (args: CreateApiApiV1EmailsUnsubscribedDeleteArgs, options?: CreateApiApiV1EmailsUnsubscribedDeleteOptions) => { const {baseUrl = "https://api.reteno.com", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/emails/unsubscribed/delete${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 };