export type ExportLoggingInfo = {api_key?: string | undefined, fileName?: string | undefined, id?: number | undefined, userId?: string | undefined, domain?: string | undefined, downloadType?: number | undefined, format?: string | undefined, searchType?: string | undefined, searchCriteria?: string | undefined, createDate?: string | undefined, expireDate?: string | undefined, status?: string | undefined, fileLocationS3?: string | undefined, lastDownloadDate?: string | undefined, lastUpdatedDate?: string | undefined, token?: string | undefined, count?: number | undefined, searchURL?: string | undefined, sensitivityLevel?: string | undefined, message?: string | undefined, expired?: boolean | undefined, deleted?: boolean | undefined}; export type GetApiContractAwardsV1DownloadArgs = {exportLoggingInfo: ExportLoggingInfo, api_key: string, token: string, ttl: string}; export type GetApiContractAwardsV1DownloadOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Download Contract Award Extract from S3 * * GET /contract-awards/v1/download */ export const getApiContractAwardsV1Download = async (args: GetApiContractAwardsV1DownloadArgs, options: GetApiContractAwardsV1DownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (args.exportLoggingInfo != null) query.append("exportLoggingInfo", JSON.stringify(args.exportLoggingInfo)) if (args.api_key != null) query.append("api_key", String(args.api_key)) if (args.token != null) query.append("token", String(args.token)) if (args.ttl != null) query.append("ttl", String(args.ttl)) const url = `${baseUrl.replace(/\/+$/, '')}/contract-awards/v1/download${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() };