export type Tokens = Array<{name: string, value: string}>; export type TemplateRoleUpdateItems = Array<{id?: string | undefined, name: string, signing_order?: (number | null) | undefined}>; export type TemplateUpdateRequest = {tokens?: Tokens | undefined, roles?: TemplateRoleUpdateItems | undefined}; export type PatchApiPublicV1TemplatesIdArgs = {id: string, body: TemplateUpdateRequest}; export type PatchApiPublicV1TemplatesIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Template Update * * PATCH /public/v1/templates/{id} * * Also accepts auth: oauth2 */ export const patchApiPublicV1TemplatesId = async (args: PatchApiPublicV1TemplatesIdArgs, options?: PatchApiPublicV1TemplatesIdOptions) => { const {baseUrl = "https://api.pandadoc.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/templates/${encodeURIComponent(String(args.id))}${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 };