export type GetApiApiV2ClientsClientIdArtifactsArtifactIdDownloadOptions = {baseUrl: string, JWTBearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a management operation artifact for the client * * GET /api/v2/clients/{client_id}/artifacts/{artifact_id}/download * * Also accepts auth: SignedRequest + RequestDate + HMACSignature */ export const getApiApiV2ClientsClientIdArtifactsArtifactIdDownload = async (options: GetApiApiV2ClientsClientIdArtifactsArtifactIdDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTBearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (JWTBearerToken !== undefined) headers.set('authorization', `Bearer ${JWTBearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/clients/${encodeURIComponent(String(args.client_id))}/artifacts/${encodeURIComponent(String(args.artifact_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 res.blob() };