export type GetApiApiOrganizationsOrganizationIdDataDataIdFilesPreviewArgs = {organizationId: number, dataId: number, fileName: string}; export type GetApiApiOrganizationsOrganizationIdDataDataIdFilesPreviewOptions = {baseUrl?: string | undefined, ApiKeyAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Preview file * * GET /api/organizations/{organizationId}/data/{dataId}/files/preview * * Also accepts auth: JWTAuthentication, JWTHttpHeaderAuthentication, OAuth2 */ export const getApiApiOrganizationsOrganizationIdDataDataIdFilesPreview = async (args: GetApiApiOrganizationsOrganizationIdDataDataIdFilesPreviewArgs, options?: GetApiApiOrganizationsOrganizationIdDataDataIdFilesPreviewOptions) => { 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 (args.fileName != null) query.append("fileName", String(args.fileName)) if (ApiKeyAuthentication !== undefined) headers.set("x-api-key", ApiKeyAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/api/organizations/${encodeURIComponent(String(args.organizationId))}/data/${encodeURIComponent(String(args.dataId))}/files/preview${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() };