export type PolicyUpdatesEmailForLangRequest = {notificationContent: string, notificationSubject: string, url: string}; export type CreateApiApiPersonsSendPolicyUpdatesEmailArgs = {registeredAfterDate: string, body: {[key: string]: Array}}; export type CreateApiApiPersonsSendPolicyUpdatesEmailOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Send email about policy updates to the users registered after registeredAfterDate param on their locale * * POST /api/persons/sendPolicyUpdatesEmail */ export const createApiApiPersonsSendPolicyUpdatesEmail = async (args: CreateApiApiPersonsSendPolicyUpdatesEmailArgs, options: CreateApiApiPersonsSendPolicyUpdatesEmailOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.registeredAfterDate != null) query.append("registeredAfterDate", String(args.registeredAfterDate)) const url = `${baseUrl.replace(/\/+$/, '')}/api/persons/sendPolicyUpdatesEmail${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 };