export type GetApiMydeliveryV1RenderingRenderContentIdArgs = {id: string, layoutId?: string | undefined, contentType?: string | undefined, callback?: string | undefined, rcParam?: string | undefined}; export type GetApiMydeliveryV1RenderingRenderContentIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Applies server side rendering to the specified content item * * GET /mydelivery/v1/rendering/render/content/{id} */ export const getApiMydeliveryV1RenderingRenderContentId = async (args: GetApiMydeliveryV1RenderingRenderContentIdArgs, options: GetApiMydeliveryV1RenderingRenderContentIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") if (args.layoutId != null) query.append("layoutId", String(args.layoutId)) if (args.contentType != null) query.append("contentType", String(args.contentType)) if (args.callback != null) query.append("callback", String(args.callback)) if (args.rcParam != null) query.append("rcParam", String(args.rcParam)) const url = `${baseUrl.replace(/\/+$/, '')}/mydelivery/v1/rendering/render/content/${encodeURIComponent(String(args.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.text() };