export type CreateApiEntityInformationV3DownloadEntitiesArgs = {token: string, api_key?: string | undefined}; export type CreateApiEntityInformationV3DownloadEntitiesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * getFileFromS3 * * POST /entity-information/v3/download-entities */ export const createApiEntityInformationV3DownloadEntities = async (args: CreateApiEntityInformationV3DownloadEntitiesArgs, options: CreateApiEntityInformationV3DownloadEntitiesOptions) => { 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/v3/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 };