export type GetApiApiInstructorsLookupArgs = {status?: number | undefined, showDeleted?: boolean | undefined, take?: number | undefined}; export type GetApiApiInstructorsLookupOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/Instructors/lookup */ export const getApiApiInstructorsLookup = async (args: GetApiApiInstructorsLookupArgs, options: GetApiApiInstructorsLookupOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.status != null) query.append("status", String(args.status)) if (args.showDeleted != null) query.append("showDeleted", String(args.showDeleted)) if (args.take != null) query.append("take", String(args.take)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/Instructors/lookup${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 };