export type GetApiV6FilesFileIdArgs = {fileId: string}; export type GetApiV6FilesFileIdOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a file asset * * GET /v6/files/{fileId} * * Also accepts auth: QUERY, COOKIE */ export const getApiV6FilesFileId = async (args: GetApiV6FilesFileIdArgs, options?: GetApiV6FilesFileIdOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/v6/files/${encodeURIComponent(String(args.fileId))}${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 undefined };