export type DocumentTransferOwnershipRequest = {membership_id?: string | undefined, silent?: boolean | undefined}; export type PatchApiPublicV1DocumentsIdOwnershipArgs = {id: string, body: DocumentTransferOwnershipRequest}; export type PatchApiPublicV1DocumentsIdOwnershipOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update document ownership * * PATCH /public/v1/documents/{id}/ownership * * Also accepts auth: oauth2 */ export const patchApiPublicV1DocumentsIdOwnership = async (args: PatchApiPublicV1DocumentsIdOwnershipArgs, options?: PatchApiPublicV1DocumentsIdOwnershipOptions) => { 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))}/ownership${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 };