export type GetApiDefectsRequiredstandardsArgs = {euVehicleCategory?: string | undefined}; export type GetApiDefectsRequiredstandardsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Required Standards (DEV) * * GET /defects/requiredstandards */ export const getApiDefectsRequiredstandards = async (args: GetApiDefectsRequiredstandardsArgs, options: GetApiDefectsRequiredstandardsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.euVehicleCategory != null) query.append("euVehicleCategory", String(args.euVehicleCategory)) const url = `${baseUrl.replace(/\/+$/, '')}/defects/requiredstandards${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 (await res.json()) as unknown };