export type GetApiV1FilesRetrieveContentArgs = {GroupId: string, file_id: number}; export type GetApiV1FilesRetrieveContentOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve File Content * * GET /v1/files/retrieve_content */ export const getApiV1FilesRetrieveContent = async (args: GetApiV1FilesRetrieveContentArgs, options?: GetApiV1FilesRetrieveContentOptions) => { const {baseUrl = "https://api.minimax.io", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.GroupId != null) query.append("GroupId", String(args.GroupId)) if (args.file_id != null) query.append("file_id", String(args.file_id)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/files/retrieve_content${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() };