export type PatchApiPosfinancingRestV2LoansIdSalespersonArgs = {id: string, body: {userId: string}}; export type PatchApiPosfinancingRestV2LoansIdSalespersonOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the sales person of a loan. * * PATCH /posfinancing/rest/v2/loans/{id}/salesperson */ export const patchApiPosfinancingRestV2LoansIdSalesperson = async (args: PatchApiPosfinancingRestV2LoansIdSalespersonArgs, options?: PatchApiPosfinancingRestV2LoansIdSalespersonOptions) => { const {baseUrl = "https://devint01-api.goodleap.com", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/posfinancing/rest/v2/loans/${encodeURIComponent(String(args.id))}/salesperson${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 };