onResponse hook on XeroClient config that will be called every response
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- nodejs, typescript
- Ambito
- api
Direzione di ricerca
The request is for an onResponse option on the XeroClient config, which would receive the raw response headers on every API call. Start from the XeroClient constructor and its config type, then find where requests are sent to see where a response callback could be invoked. The issue's example headers (X-DayLimit-Remaining and related) show the data the hook must expose. Done means the callback fires on each response with the headers available, and the README documents it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
SDK you're using (please complete the following information):
- Version: 4.29.0
Is your feature request related to a problem? Please describe.
Yes.Xero API's enforces the following rate limits:
- 5 concurrent request (per tenant)
- 60 requests per minute (per tenant)
- 5,000 request per day (per tenant)
- 10,000 requests per day (hard limit on the app level)
I'm currently creating a solution that works with these constraints.
Describe the solution you'd like
We want to be able to specify a hook on the XeroClient level like so:
import { XeroClient } from 'xero-node';
const client = new XeroClient({
clientId: process.env.XERO_CLIENT_ID,
clientSecret: process.env.XERO_CLIENT_SECRET,
redirectUris: [process.env.XERO_REDIRECT_URI],
scopes: [
'openid',
'profile',
'email',
'accounting.settings',
'payroll.employees',
'payroll.payruns',
'offline_access'
],
onResponse: (response: IncomingMessage) => {
const dayRemaining = response.headers['X-DayLimit-Remaining'];
const minuteRemaining = response.headers['X-MinLimit-Remaining'];
const AppMinLimit = response.headers['X-AppMinLimit-Remaining'];
// do something
}
});
Describe alternatives you've considered
No alternatives available other than to write your own helper function that handles these everytime you make a request which isn't as good and causes a lot of code repetition.
Additional context
N/A
- Lingua principale
- TypeScript
- Stelle
- 264
- Fork
- 177
- Merge medio
- 10h 5m
- PR unite (30g)
- 5
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di XeroAPI/xero-node
-
`getClientCredentialsToken()` sends `scopes` (comma-joined) instead of the OAuth `scope` parameterAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
-
TrackingOptionId value missing from accountingApi.getInvoices()Forse già presa @miachillgood l’ha presa 152 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 18/100
-
BankTransaction type is missing the batchPayment object.Forse già presa @miachillgood l’ha presa 171 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 22/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
Tutte le issue di XeroAPI/xero-node
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
super-productivity/super-productivity#12128 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
A docs change can fail pnpm check, because outreach lint and gen:types both write .astro/ at onceForse già presa @2389400626lh-ops l’ha presa oggi. ApertaArea: Infrastructure Area: Outreach Bug Difficulty: Low Good First Issue Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DouglasNeuroInformatics/OpenDataCapture#1956 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
justyns/silverbullet-ai#199 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
spartan-ng/spartan#1931 ·
I maintainer di solito rispondono entro 2 giorni