export type GetApiApiProjectIdRawDataSampleIdWavArgs = {projectId: number, sampleId: number, axisIx: number, sliceStart?: number | undefined, sliceEnd?: number | undefined, cacheKey?: string | undefined, datasetVersionId?: number | undefined}; export type GetApiApiProjectIdRawDataSampleIdWavOptions = {baseUrl?: string | undefined, ApiKeyAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get WAV file * * GET /api/{projectId}/raw-data/{sampleId}/wav * * Also accepts auth: JWTAuthentication, JWTHttpHeaderAuthentication, OAuth2 */ export const getApiApiProjectIdRawDataSampleIdWav = async (args: GetApiApiProjectIdRawDataSampleIdWavArgs, options?: GetApiApiProjectIdRawDataSampleIdWavOptions) => { const {baseUrl = "https://studio.edgeimpulse.com/v1", fetch: fetchFn = fetch, ApiKeyAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "audio/wav") if (args.axisIx != null) query.append("axisIx", String(args.axisIx)) if (args.sliceStart != null) query.append("sliceStart", String(args.sliceStart)) if (args.sliceEnd != null) query.append("sliceEnd", String(args.sliceEnd)) if (args.cacheKey != null) query.append("cacheKey", String(args.cacheKey)) if (args.datasetVersionId != null) query.append("datasetVersionId", String(args.datasetVersionId)) if (ApiKeyAuthentication !== undefined) headers.set("x-api-key", ApiKeyAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.projectId))}/raw-data/${encodeURIComponent(String(args.sampleId))}/wav${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() };