export type GetApiUserDomainNotificationsPreferencesArgs = {domain: string, 'x-auth-domain': string, 'x-auth-expires': string, 'x-auth-signature': string}; export type GetApiUserDomainNotificationsPreferencesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get domain notification preferences * * GET /user/{domain}/notifications/preferences */ export const getApiUserDomainNotificationsPreferences = async (args: GetApiUserDomainNotificationsPreferencesArgs, options?: GetApiUserDomainNotificationsPreferencesOptions) => { const {baseUrl = "https://api.unstoppabledomains.com/profile", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-auth-domain'] != null) headers.set("x-auth-domain", String(args['x-auth-domain'])) if (args['x-auth-expires'] != null) headers.set("x-auth-expires", String(args['x-auth-expires'])) if (args['x-auth-signature'] != null) headers.set("x-auth-signature", String(args['x-auth-signature'])) const url = `${baseUrl.replace(/\/+$/, '')}/user/${encodeURIComponent(String(args.domain))}/notifications/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 undefined };