export type CreateApiEntityInformationV4DownloadEntitiesArgs = {token: string, api_key?: string | undefined}; export type CreateApiEntityInformationV4DownloadEntitiesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * getFileFromS3 * * POST /entity-information/v4/download-entities */ export const createApiEntityInformationV4DownloadEntities = async (args: CreateApiEntityInformationV4DownloadEntitiesArgs, options: CreateApiEntityInformationV4DownloadEntitiesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.token != null) query.append("token", String(args.token)) if (args.api_key != null) query.append("api_key", String(args.api_key)) const url = `${baseUrl.replace(/\/+$/, '')}/entity-information/v4/download-entities${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };