Skip to content

fix: expose Payroll AU v2 API client - #819

Open
ryanduguid wants to merge 2 commits into
XeroAPI:masterfrom
ryanduguid:agent/wire-payroll-au-v2
Open

fix: expose Payroll AU v2 API client#819
ryanduguid wants to merge 2 commits into
XeroAPI:masterfrom
ryanduguid:agent/wire-payroll-au-v2

Conversation

@ryanduguid

Copy link
Copy Markdown

What changed

  • export the already-generated PayrollAuV2Api
  • construct it on XeroClient as payrollAUV2Api
  • propagate access-token changes through one client registry
  • cover construction and token propagation with regression tests

Why

The generated Payroll AU v2 class exists, but it is omitted from the public API barrel and XeroClient. Consumers therefore cannot use it through the supported client surface, and token refreshes do not reach it.

Generator follow-up

src/gen/api/apis.ts is generated code. This patch is a narrow interim SDK correction; the owning generator/template should add Payroll AU v2 to its API registry so the fix survives regeneration.

Validation

  • npm ci
  • npm run build
  • npm test -- --runInBand — 17 tests passed
  • git diff --check

@ryanduguid
ryanduguid marked this pull request as ready for review August 18, 2026 15:06
apiClients was a fourth parallel list, alongside the constructor
assignments, the field declarations and the generated APIS export, with
nothing keeping them in step. A client added to the constructor but missed
here was silently skipped by setAccessToken(), leaving every call on it
returning 401.

The list is now derived from the clients built in the constructor, filtered
against xero.APIS, so wiring a client is enough to have it receive the token.

Adds a test that walks xero.APIS and asserts each generated client actually
holds the access token. It fails on divergence: dropping financeApi from the
old hand-maintained array leaves its accessToken empty while every other
test still passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant