export type GetApiVisV2OrgsOrgIdQueriesIdDownloadArgs = {skipToken?: string | undefined, maxResults?: number | undefined, orgId: number, id: string}; export type GetApiVisV2OrgsOrgIdQueriesIdDownloadOptions = {baseUrl?: string | undefined, JWTAuthHeaderAuthorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download query results * * GET /vis/v2/orgs/{orgId}/queries/{id}/download */ export const getApiVisV2OrgsOrgIdQueriesIdDownload = async (args: GetApiVisV2OrgsOrgIdQueriesIdDownloadArgs, options?: GetApiVisV2OrgsOrgIdQueriesIdDownloadOptions) => { const {baseUrl = "https://api.flexera.com", fetch: fetchFn = fetch, JWTAuthHeaderAuthorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.skipToken != null) query.append("skipToken", String(args.skipToken)) if (args.maxResults != null) query.append("maxResults", String(args.maxResults)) if (JWTAuthHeaderAuthorization !== undefined) headers.set('authorization', `Bearer ${JWTAuthHeaderAuthorization}`) const url = `${baseUrl.replace(/\/+$/, '')}/vis/v2/orgs/${encodeURIComponent(String(args.orgId))}/queries/${encodeURIComponent(String(args.id))}/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 undefined };