export type GetApiCustomersEnrollmentsSecureUserIdArgs = {secureUserId: number, season?: number | undefined, modifiedsince?: string | undefined}; export type GetApiCustomersEnrollmentsSecureUserIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /customers/enrollments/{secureUserId} */ export const getApiCustomersEnrollmentsSecureUserId = async (args: GetApiCustomersEnrollmentsSecureUserIdArgs, options: GetApiCustomersEnrollmentsSecureUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.season != null) query.append("season", String(args.season)) if (args.modifiedsince != null) query.append("modifiedsince", String(args.modifiedsince)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/customers/enrollments/${encodeURIComponent(String(args.secureUserId))}${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 };