export type GetApiApiChannelsEmailCustomUnsubscribeArgs = {ua_unsubscribe_token: string, ua_redirect?: string | undefined}; export type GetApiApiChannelsEmailCustomUnsubscribeOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Custom unsubscribe email channel * * GET /api/channels/email/custom-unsubscribe */ export const getApiApiChannelsEmailCustomUnsubscribe = async (args: GetApiApiChannelsEmailCustomUnsubscribeArgs, options?: GetApiApiChannelsEmailCustomUnsubscribeOptions) => { const {baseUrl = "https://go.urbanairship.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ua_unsubscribe_token != null) query.append("ua_unsubscribe_token", String(args.ua_unsubscribe_token)) if (args.ua_redirect != null) query.append("ua_redirect", String(args.ua_redirect)) const url = `${baseUrl.replace(/\/+$/, '')}/api/channels/email/custom-unsubscribe${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 };