export type UpdateApiApiV2UserNotificationInboundArgs = {body: {inboundMessageNotification: boolean, includeSmsHistory: boolean, sendInHtmlFormat: boolean, alertEmail1?: string | undefined, alertEmail2?: string | undefined, alertEmail3?: string | undefined}}; export type UpdateApiApiV2UserNotificationInboundOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update inbound messages notification settings * * PUT /api/v2/user/notification/inbound */ export const updateApiApiV2UserNotificationInbound = async (args: UpdateApiApiV2UserNotificationInboundArgs, options?: UpdateApiApiV2UserNotificationInboundOptions) => { const {baseUrl = "https://rest.textmagic.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/v2/user/notification/inbound${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };