export type ResourceId = string; export type User = {name?: string | undefined, role?: string | undefined, email?: string | undefined, phone?: string | undefined}; export type Organization = {name?: string | undefined, address?: string | undefined, city?: string | undefined, state?: string | undefined, postalCode?: string | undefined, pointOfContact?: User | undefined}; export type TransactionResource = {name: string, mimeType: 'text/plain' | 'application/xml' | 'application/json' | 'image/jpeg' | 'image/png' | 'image/bmp' | 'image/gif' | 'application/msword' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'text/html' | 'application/vnd.ms-xpsdocument' | 'application/emf' | 'application/zip' | 'application/pdf' | 'text/csv', type?: string | undefined, id: string}; export type ProductDataEntitlementsResultFormat = 'application/vnd.productpricing-lock-1.0.0.json' | 'application/vnd.productpricing-extendlock-1.0.0.json' | 'application/vnd.productpricing-relock-1.0.0.json' | 'application/vnd.productpricing-cancellock-1.0.0.json' | 'application/vnd.productpricing-lock-and-confirm-1.0.0.json'; export type TransactionResponseResult = {resultFormat: ProductDataEntitlementsResultFormat, action: 'LOCK' | 'RELOCK' | 'EXTEND' | 'CANCEL' | 'LOCK_CONFIRM', details: Record}; export type ErrorModel = {code: string, description: string, type?: 'system' | undefined, fieldId?: string | undefined, resourceId: 'TRANSACTION' | 'PRODUCT' | 'ORIGIN'}; export type Errors = Array; export type TransactionInputRequired = {name?: string | undefined, type?: ('field' | 'resource') | undefined, value?: string | undefined, description?: string | undefined, jsonPath?: string | undefined}; export type TransactionResponse = {status: 'processing' | 'completed' | 'failed' | 'canceled' | 'inputRequired', referenceNumber: string, partnerStatus?: string | undefined, respondingParty?: Organization | undefined, loanFormat?: 'application/vnd.plm-2.0.0+json' | undefined, loan?: Record | undefined, resources?: Array | undefined, result?: TransactionResponseResult | undefined, errors?: Errors | undefined, inputRequired?: Array | undefined}; export type PatchApiTransactionsTransactionIdResponseArgs = {Authorization: string, transaction_id: ResourceId, body: TransactionResponse}; export type PatchApiTransactionsTransactionIdResponseOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update transaction response * * PATCH /transactions/{transaction_id}/response */ export const patchApiTransactionsTransactionIdResponse = async (args: PatchApiTransactionsTransactionIdResponseArgs, options?: PatchApiTransactionsTransactionIdResponseOptions) => { const {baseUrl = "https://api.elliemae.com/oauth2/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/transactions/${encodeURIComponent(String(args.transaction_id))}/response${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 };