Skip to content

feat: add Intra v3 API support - #54

Merged
FreekBes merged 3 commits into
mainfrom
api-v3-support
Jul 13, 2026
Merged

feat: add Intra v3 API support#54
FreekBes merged 3 commits into
mainfrom
api-v3-support

Conversation

@FreekBes

Copy link
Copy Markdown
Member

Add Intra v3 API support (Fast42v3)

Adds a separate client for the Intra v3 API alongside the existing v2 Fast42.

Why a separate client

v3 isn't a versioned path on api.intra.42.fr — it's a set of independent microservices (pace-system, freeze, chronos, alumni-management), each on its own host. It also authenticates completely differently: OIDC (Keycloak staff-42 realm) with the password/refresh grant instead of v2's client_credentials, and has no rate limits. Since the two share almost nothing, v3 lives in its own Fast42v3 class.

What's included

  • Fast42v3 — per-service routing (get('pace-system', 'v1', '/milestones')), OIDC token manager (password grant → auto refresh, refreshToken(totp) for 2FA re-auth), v3 pagination (page/size, reads pages from the body), and the same 429/5xx retry policy.
  • Refactor — split index.ts into shared.ts / v2.ts / v3.ts; index.ts is now the entry point.
  • Tests — 18 new v3 tests; renamed index.test.tsv2.test.ts (31 passing total).
  • Docs — README section for v3.

Backwards compatibility

Fully compatible. import Fast42 from '@codam/fast42' and all existing exports/methods are unchanged; everything new is additive.

Validated

Live-tested against the real v3 API: auth, token acceptance, and pagination all confirmed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Fast42v3 client to support the Intra v3 microservice-based API alongside the existing v2 Fast42 client, including shared retry helpers, updated entrypoint exports, tests, and documentation.

Changes:

  • Introduces Fast42v3 with OIDC (password + refresh token) auth, per-service URL routing, and v3-style pagination helpers.
  • Refactors v2 implementation into src/v2.ts and extracts shared retry/query helpers into src/shared.ts, with src/index.ts becoming a re-export entrypoint.
  • Adds v3 test coverage and updates docs/Jest config for the new module layout.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/v3.test.ts Adds v3-focused tests covering auth, routing, pagination, and token refresh behavior.
tests/v2.test.ts Updates v2 tests to import from the new src/v2 module.
src/v3.ts Implements the Fast42v3 client (OIDC token handling + microservice request helpers).
src/v2.ts Moves the existing v2 client implementation into its own module and uses shared helpers.
src/shared.ts Adds shared retry/query helpers for both clients.
src/index.ts Updates package entrypoint exports for v2 default + v3 named export.
README.md Documents usage/configuration for Fast42v3.
jest.config.js Maps .js-suffixed relative imports to TS sources for ts-jest runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/v3.ts
Comment thread src/v2.ts
Comment thread src/index.ts
Comment thread src/v3.ts Outdated
Comment thread src/shared.ts
Comment thread src/shared.ts Outdated
@FreekBes FreekBes added the enhancement New feature or request label Jul 13, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@FreekBes
FreekBes merged commit 7acdc93 into main Jul 13, 2026
1 check passed
@FreekBes
FreekBes deleted the api-v3-support branch July 13, 2026 13:11
github-actions Bot pushed a commit that referenced this pull request Jul 13, 2026
# [3.1.0](v3.0.0...v3.1.0) (2026-07-13)

### Features

* add Intra v3 API support ([#54](#54)) ([7acdc93](7acdc93))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants