export type KerasModelTypeEnum = 'int8' | 'float32' | 'akida' | 'requiresRetrain'; export type DeploymentTargetEngine = 'tflite' | 'tflite-eon' | 'tflite-eon-ram-optimized' | 'tensorrt' | 'tensaiflow' | 'drp-ai' | 'tidl' | 'akida' | 'syntiant' | 'memryx' | 'neox' | 'ethos-linux' | 'st-aton' | 'ceva-npn' | 'nordic-axon' | 'vlm-connector' | 'qaic'; export type GetApiApiProjectIdDeploymentDownloadArgs = {projectId: number, type: string, modelType?: KerasModelTypeEnum | undefined, engine?: DeploymentTargetEngine | undefined, impulseId?: number | undefined}; export type GetApiApiProjectIdDeploymentDownloadOptions = {baseUrl?: string | undefined, ApiKeyAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download * * GET /api/{projectId}/deployment/download * * Also accepts auth: JWTAuthentication, JWTHttpHeaderAuthentication, OAuth2 */ export const getApiApiProjectIdDeploymentDownload = async (args: GetApiApiProjectIdDeploymentDownloadArgs, options?: GetApiApiProjectIdDeploymentDownloadOptions) => { const {baseUrl = "https://studio.edgeimpulse.com/v1", fetch: fetchFn = fetch, ApiKeyAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (args.type != null) query.append("type", String(args.type)) if (args.modelType != null) query.append("modelType", String(args.modelType)) if (args.engine != null) query.append("engine", String(args.engine)) if (args.impulseId != null) query.append("impulseId", String(args.impulseId)) if (ApiKeyAuthentication !== undefined) headers.set("x-api-key", ApiKeyAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.projectId))}/deployment/download${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() };