export type Template = {type?: string | undefined, id?: string | undefined, attributes?: ({createdBy?: string | undefined, createdDate?: string | undefined, description?: string | undefined, name?: string | undefined, tcl?: string | undefined, updatedBy?: string | undefined, updatedDate?: string | undefined, version?: string | undefined}) | undefined, relationships?: ({organization?: ({id?: string | undefined, type?: 'organization' | undefined}) | undefined}) | undefined}; export type PatchApiTemplateTemplateIdArgs = {body: {data?: Template | undefined}}; export type PatchApiTemplateTemplateIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Modifies an instance of type template * * PATCH /template/{templateId} */ export const patchApiTemplateTemplateId = async (args: PatchApiTemplateTemplateIdArgs, options: PatchApiTemplateTemplateIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") const url = `${baseUrl.replace(/\/+$/, '')}/template/${encodeURIComponent(String(args.templateId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };