export type GetApiV2ContactContactIDPreferencesArgs = {contactID: number}; export type GetApiV2ContactContactIDPreferencesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the preferences for the specified contact * * GET /v2/contact/{contactID}/preferences */ export const getApiV2ContactContactIDPreferences = async (args: GetApiV2ContactContactIDPreferencesArgs, options?: GetApiV2ContactContactIDPreferencesOptions) => { const {baseUrl = "https://api.dotdigital.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") const url = `${baseUrl.replace(/\/+$/, '')}/v2/contact/${encodeURIComponent(String(args.contactID))}/preferences${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };