//native
type Codat = {
encodedKey: string
}
/**
* Get transfer
* The *Get transfer* endpoint returns a single transfer for a given transferId.
[Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account.
Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
*/
export async function main(
auth: Codat,
companyId: string,
connectionId: string,
transferId: string
) {
const url = new URL(
`https://api.codat.io/companies/${companyId}/connections/${connectionId}/data/transfers/${transferId}`
)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Basic ${auth.encodedKey}`
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago