export type RecipientDeliveryMethods = {email?: boolean | undefined, sms?: boolean | undefined} | null; export type RecipientRedirect = {is_enabled: boolean, url: string | null}; export type UpdateDocumentRecipient = {email?: (string | null) | undefined, phone?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined, id?: string | undefined, delivery_methods?: RecipientDeliveryMethods | undefined, redirect?: RecipientRedirect | undefined, type?: 'recipient' | undefined, signing_order?: (number | null) | undefined}; export type BaseIdentity = {email?: (string | null) | undefined, phone?: (string | null) | undefined, first_name?: (string | null) | undefined, last_name?: (string | null) | undefined}; export type UpdateDocumentRecipientGroup = {id?: string | undefined, name: string, type?: 'recipient_group' | undefined, members?: Array | undefined, signing_order?: (number | null) | undefined}; export type UpdateDocumentActor = UpdateDocumentRecipient | UpdateDocumentRecipientGroup; export type DocumentUpdateRequestField = {[key: string]: {value: boolean | string | number}}; export type PricingTableRequest = {name: string, data_merge?: boolean | undefined, options?: Record | undefined, sections: Array<{title: string, default: boolean, multichoice_enabled?: boolean | undefined, rows?: (Array<{options: {qty_editable?: boolean | undefined, optional_selected?: boolean | undefined, optional?: boolean | undefined}, data: {images?: Array<{src: string}> | undefined, pricing_method?: ('volume_based_price' | 'volume_based_discount_price') | undefined, tiers?: Array<{min_qty: number, value: number}> | undefined} | {[key: string]: unknown}, custom_fields?: Record | undefined}>) | undefined}>}; export type TableCell = {text: string, col_span?: (number | null) | undefined, row_span?: (number | null) | undefined}; export type TableRequest = {name: string, data: {sections: Array<{header: Array, rows: Array>}>}}; export type DocumentUpdateRequest = {name?: string | undefined, recipients?: Array | undefined, fields?: DocumentUpdateRequestField | undefined, tokens?: Array<{name: string, value: string}> | undefined, tags?: Array | undefined, metadata?: Record | undefined, pricing_tables?: Array | undefined, tables?: Array | undefined, images?: Array<{urls: Array, name: string}> | undefined, texts?: Array<{name: string, data: string}> | undefined}; export type PatchApiPublicV1DocumentsIdArgs = {id: string, body: DocumentUpdateRequest}; export type PatchApiPublicV1DocumentsIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Document * * PATCH /public/v1/documents/{id} * * Also accepts auth: oauth2 */ export const patchApiPublicV1DocumentsId = async (args: PatchApiPublicV1DocumentsIdArgs, options?: PatchApiPublicV1DocumentsIdOptions) => { 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/documents/${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 };