export type GetApiTranslationRequestsIdDownloadSourceArgs = {id: string, format?: ('arb' | 'xliff-1.2' | 'xliff-2.0') | undefined}; export type GetApiTranslationRequestsIdDownloadSourceOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download source file for translation request * * GET /translation-requests/{id}/download-source */ export const getApiTranslationRequestsIdDownloadSource = async (args: GetApiTranslationRequestsIdDownloadSourceArgs, options?: GetApiTranslationRequestsIdDownloadSourceOptions) => { const {baseUrl = "https://enterprise.knak.io/api/published/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/xml") if (args.format != null) query.append("format", String(args.format)) const url = `${baseUrl.replace(/\/+$/, '')}/translation-requests/${encodeURIComponent(String(args.id))}/download-source${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() };