//native
type Codat = {
encodedKey: string
}
/**
* Configure
* The *Configure* endpoint allows you to maintain or change configuration required to return supplemental data for each integration and data type combination.
[Supplemental data](https://docs.codat.io/using-the-api/supplemental-data/overview) is additional data you can include in Codat's standard data types.
**Integration-specific behaviour**
See the *examples* for integration-specific frequently requested properties.
*/
export async function main(
auth: Codat,
platformKey: string,
dataType:
| 'chartOfAccounts'
| 'bills'
| 'company'
| 'creditNotes'
| 'customers'
| 'invoices'
| 'items'
| 'journalEntries'
| 'suppliers'
| 'taxRates'
| 'commerce-companyInfo'
| 'commerce-customers'
| 'commerce-disputes'
| 'commerce-locations'
| 'commerce-orders'
| 'commerce-payments'
| 'commerce-paymentMethods'
| 'commerce-products'
| 'commerce-productCategories'
| 'commerce-taxComponents'
| 'commerce-transactions',
body: { supplementalDataConfig?: {} }
) {
const url = new URL(
`https://api.codat.io/integrations/${platformKey}/dataTypes/${dataType}/supplementalDataConfig`
)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: `Basic ${auth.encodedKey}`
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago