export type GetApiV2ContactsContactEmailSubscriptionsArgs = {contactEmail: string}; export type GetApiV2ContactsContactEmailSubscriptionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the subscriptions for the specified contact * * GET /v2/contacts/{contactEmail}/subscriptions */ export const getApiV2ContactsContactEmailSubscriptions = async (args: GetApiV2ContactsContactEmailSubscriptionsArgs, options?: GetApiV2ContactsContactEmailSubscriptionsOptions) => { 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.contactEmail))}/subscriptions${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() };