[codex] Add hosted endpoint SDK methods#10
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 110b1d9e46
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| arrivalBoard(query: BusArrivalBoardQuery): Promise<BusArrivalBoardStop[]> { | ||
| return this.mta.hostedJson<BusArrivalBoardStop[]>("/api/v1/bus/arrival-board", { | ||
| ...query, | ||
| route: query.route ? normalizeBusRouteId(query.route) : undefined, |
There was a problem hiding this comment.
Preserve exact local bus route filters
When callers request a local route that also has a separate SBS variant, this rewrites the filter before the hosted API sees it; for example src/generated.ts exposes both M15 and M15-SBS, but arrivalBoard({ route: "M15" }) is sent as route=M15-SBS, making it impossible to fetch the local M15 board through this new method. The new routeStops wrapper repeats the same normalization, so exact local-route stop lists are affected as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds first-class, typed SDK wrappers in mta-js for the newly expanded hosted API surface (arrival boards, stop batch lookup, route catalog, and per-route stop/station patterns), along with accompanying request/response types, docs, and hosted fetch-mock tests.
Changes:
- Added new request/response types for hosted arrival boards, stop batch lookup, route catalog, and route stop/station patterns.
- Added new SDK client methods (
subway.arrivalBoard,bus.arrivalBoard,stops.byIds,routes.list,subway.routeStations,bus.routeStops) that call the managed/api/v1/...endpoints with appropriate query normalization. - Updated README examples and expanded hosted endpoint tests to cover the new wrappers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/types.ts |
Adds typed request/response contracts for the hosted endpoint expansion (arrival boards, stop lookup, route catalog, route patterns). |
README.md |
Updates examples and endpoint list to include the new hosted wrappers. |
index.ts |
Implements the new client methods and introduces a routes client on the MTA instance. |
index.test.ts |
Adds a fetch-mocked test asserting the new methods hit the expected hosted paths and serialize query params correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Adds typed
mta-jshosted API wrappers for the endpoint expansion that landed inmta-api:mta.subway.arrivalBoard(...)mta.bus.arrivalBoard(...)mta.stops.byIds(...)mta.routes.list(...)mta.subway.routeStations(...)mta.bus.routeStops(...)Also adds request/response types for the new hosted endpoint contracts and updates the README endpoint examples.
Closes #9
Validation
bun testbun run typecheck