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