export type GetApiNhtsaComponentApiV1ComponentDocumentsTestNoTestNoArgs = {testNo: string}; export type GetApiNhtsaComponentApiV1ComponentDocumentsTestNoTestNoOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /nhtsa/component/api/v1/component-documents/test-no/{testNo} */ export const getApiNhtsaComponentApiV1ComponentDocumentsTestNoTestNo = async (args: GetApiNhtsaComponentApiV1ComponentDocumentsTestNoTestNoArgs, options: GetApiNhtsaComponentApiV1ComponentDocumentsTestNoTestNoOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/nhtsa/component/api/v1/component-documents/test-no/${encodeURIComponent(String(args.testNo))}${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 res.blob() };