export type GetApiApiProjectIdLearnDataLearnIdModelModelDownloadIdArgs = {projectId: number, learnId: number, modelDownloadId: string}; export type GetApiApiProjectIdLearnDataLearnIdModelModelDownloadIdOptions = {baseUrl?: string | undefined, ApiKeyAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download trained model * * GET /api/{projectId}/learn-data/{learnId}/model/{modelDownloadId} * * Also accepts auth: JWTAuthentication, JWTHttpHeaderAuthentication, OAuth2 */ export const getApiApiProjectIdLearnDataLearnIdModelModelDownloadId = async (args: GetApiApiProjectIdLearnDataLearnIdModelModelDownloadIdArgs, options?: GetApiApiProjectIdLearnDataLearnIdModelModelDownloadIdOptions) => { const {baseUrl = "https://studio.edgeimpulse.com/v1", fetch: fetchFn = fetch, ApiKeyAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (ApiKeyAuthentication !== undefined) headers.set("x-api-key", ApiKeyAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.projectId))}/learn-data/${encodeURIComponent(String(args.learnId))}/model/${encodeURIComponent(String(args.modelDownloadId))}${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() };