export type GetApiDocumentsDownloadDcpIdArgs = {dcp_id: string}; export type GetApiDocumentsDownloadDcpIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Document File * * GET /documents/download/{dcp_id} */ export const getApiDocumentsDownloadDcpId = async (args: GetApiDocumentsDownloadDcpIdArgs, options?: GetApiDocumentsDownloadDcpIdOptions) => { const {baseUrl = "https://api.renesas.com/web-data/v1", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/documents/download/${encodeURIComponent(String(args.dcp_id))}${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() };