export type GetApiRestapiJsonV1ResourcesResourceIdAccountsAccountIdDownloadfileArgs = {orgName?: string | undefined, resourceId: number, accountId: number, INPUT_DATA?: ({operation?: ({Details?: ({REASON?: string | undefined, TICKETID?: string | undefined, ISCUSTOMFIELD?: ('true' | 'false') | undefined, CUSTOMFIELDTYPE?: string | undefined, CUSTOMFIELDLABEL?: string | undefined, CUSTOMFIELDCOLUMNNAME?: string | undefined}) | undefined}) | undefined}) | undefined}; export type GetApiRestapiJsonV1ResourcesResourceIdAccountsAccountIdDownloadfileOptions = {baseUrl?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download file/keystore/certificate for an account * * GET /restapi/json/v1/resources/{resourceId}/accounts/{accountId}/downloadfile */ export const getApiRestapiJsonV1ResourcesResourceIdAccountsAccountIdDownloadfile = async (args: GetApiRestapiJsonV1ResourcesResourceIdAccountsAccountIdDownloadfileArgs, options?: GetApiRestapiJsonV1ResourcesResourceIdAccountsAccountIdDownloadfileOptions) => { const {baseUrl = "https://Hostname:Port", fetch: fetchFn = fetch, AuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.orgName != null) headers.set("orgName", String(args.orgName)) if (args.INPUT_DATA != null) query.append("INPUT_DATA", JSON.stringify(args.INPUT_DATA)) if (AuthToken !== undefined) headers.set("AUTHTOKEN", AuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/restapi/json/v1/resources/${encodeURIComponent(String(args.resourceId))}/accounts/${encodeURIComponent(String(args.accountId))}/downloadfile${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() };