export type GetApiAccountRegisterValidatevoucherArgs = {code?: string | undefined, membershipLevelId?: number | undefined}; export type GetApiAccountRegisterValidatevoucherOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Validates a membership level promo code * * GET /account/register/validatevoucher */ export const getApiAccountRegisterValidatevoucher = async (args: GetApiAccountRegisterValidatevoucherArgs, options?: GetApiAccountRegisterValidatevoucherOptions) => { const {baseUrl = "https://api.travelify.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.code != null) query.append("code", String(args.code)) if (args.membershipLevelId != null) query.append("membershipLevelId", String(args.membershipLevelId)) const url = `${baseUrl.replace(/\/+$/, '')}/account/register/validatevoucher${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 };