export type GetApiArticleIdIdDownloadArticleImageArgs = {id: string, articleImageId: string, preview?: boolean | undefined, scaleWidth?: number | undefined, scaleHeight?: number | undefined}; export type GetApiArticleIdIdDownloadArticleImageOptions = {baseUrl: string, APIToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /article/id/{id}/downloadArticleImage */ export const getApiArticleIdIdDownloadArticleImage = async (args: GetApiArticleIdIdDownloadArticleImageArgs, options: GetApiArticleIdIdDownloadArticleImageOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.articleImageId != null) query.append("articleImageId", String(args.articleImageId)) if (args.preview != null) query.append("preview", String(args.preview)) if (args.scaleWidth != null) query.append("scaleWidth", String(args.scaleWidth)) if (args.scaleHeight != null) query.append("scaleHeight", String(args.scaleHeight)) if (APIToken !== undefined) headers.set("AuthenticationToken", APIToken) const url = `${baseUrl.replace(/\/+$/, '')}/article/id/${encodeURIComponent(String(args.id))}/downloadArticleImage${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 };