export type GetApiV2ContactsContactIDPreferencesArgs = {contactID: number}; export type GetApiV2ContactsContactIDPreferencesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the preferences for the specified contact * * GET /v2/contacts/{contactID}/preferences */ export const getApiV2ContactsContactIDPreferences = async (args: GetApiV2ContactsContactIDPreferencesArgs, options?: GetApiV2ContactsContactIDPreferencesOptions) => { 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/contacts/${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() };