export type GetApiApiOrganizationsOrganizationIdDataDownloadArgs = {organizationId: number, dataset?: string | undefined, dataIds: string, filter?: string | undefined}; export type GetApiApiOrganizationsOrganizationIdDataDownloadOptions = {baseUrl?: string | undefined, ApiKeyAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download data * * GET /api/organizations/{organizationId}/data/download * * Also accepts auth: JWTAuthentication, JWTHttpHeaderAuthentication, OAuth2 */ export const getApiApiOrganizationsOrganizationIdDataDownload = async (args: GetApiApiOrganizationsOrganizationIdDataDownloadArgs, options?: GetApiApiOrganizationsOrganizationIdDataDownloadOptions) => { const {baseUrl = "https://studio.edgeimpulse.com/v1", fetch: fetchFn = fetch, ApiKeyAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/x-tar") if (args.dataset != null) query.append("dataset", String(args.dataset)) if (args.dataIds != null) query.append("dataIds", String(args.dataIds)) if (args.filter != null) query.append("filter", String(args.filter)) if (ApiKeyAuthentication !== undefined) headers.set("x-api-key", ApiKeyAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/api/organizations/${encodeURIComponent(String(args.organizationId))}/data/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() };