@accounty/rompslomp
v0.6.3
Published
<img src="https://cdn.jsdelivr.net/npm/@accounty/rompslomp/banner.png" alt="Accounty — Many providers. One interface." />
Readme
@accounty/rompslomp
Contacts and sales invoices from Rompslomp.
Installation
yarn add @accounty/rompslompUsage
Authentication: OAuth 2.0.
import Rompslomp from '@accounty/rompslomp'
const provider = new Rompslomp({})
await provider.setCredentials({ accessToken: '<access-token>' })
const [administration] = await provider.getAdministrations()
if (!administration) {
throw new Error('No administration available')
}
await provider.setSettings(administration)
const { data: invoices } = await provider.fetchInvoices()Select the administration your user intends to access; the example uses the first.
For OAuth authorization and token refresh, pass clientId, clientSecret, and redirectUri
to the constructor. Persist credentials returned by getOauthToken() or
setCredentials(). See the OAuth guide.
Supported behavior
getAdministrations()lists companies; pass the selected object tosetSettings()before fetching data.fetchCompanies(),fetchInvoices(), andfetchInvoicesWithCompany()return normalized records.downloadInvoice(remoteId)returns the sales-invoice PDF as aBuffer.- Authorization requests
public manage:sales_invoices manage:contacts.
Fetch methods return { data, version? }. Amounts are integer cents, dates are
Date objects, and remoteData preserves provider records. Filter support varies
by provider.
