Skip to content

[codex] Add hosted endpoint SDK methods#10

Merged
gtokman merged 2 commits into
mainfrom
codex/hosted-endpoint-methods
May 30, 2026
Merged

[codex] Add hosted endpoint SDK methods#10
gtokman merged 2 commits into
mainfrom
codex/hosted-endpoint-methods

Conversation

@gtokman
Copy link
Copy Markdown
Contributor

@gtokman gtokman commented May 30, 2026

Summary

Adds typed mta-js hosted API wrappers for the endpoint expansion that landed in mta-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 test
  • bun run typecheck

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread index.ts Outdated
arrivalBoard(query: BusArrivalBoardQuery): Promise<BusArrivalBoardStop[]> {
return this.mta.hostedJson<BusArrivalBoardStop[]>("/api/v1/bus/arrival-board", {
...query,
route: query.route ? normalizeBusRouteId(query.route) : undefined,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@gtokman gtokman merged commit 68387e4 into main May 30, 2026
5 checks passed
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.

Update mta-js methods and types for hosted endpoint expansion

2 participants