• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / next-departures-api / 25151801903

30 Apr 2026 06:54AM UTC coverage: 16.632% (-2.0%) from 18.662%
25151801903

push

github

web-flow
feat: add next departures endpoint via SIRI API (#7)

Adds a new endpoint `GET /v1/next-departures/:stopId` to fetch real-time
departure information using the **SIRI** (Service Interface for
Real-time
Information) standard.

The implementation includes:
*   A new `SiriClient` to communicate with **TransportAPI**.
*   XML request/response models for SIRI Stop Monitoring.
*   Mapping logic to convert SIRI XML responses into a concise JSON
    format for the API consumers.
*   Updated environment configuration for API credentials.

```mermaid
sequenceDiagram
    participant C as Client
    participant S as API Server
    participant L as SiriClient
    participant T as TransportAPI

    C->>S: GET /v1/next-departures/:stopId
    S->>L: GetStopMonitoring(stopId)
    L->>T: POST /nextbuses (XML Request)
    T-->>L: 200 OK (XML Response)
    L-->>S: Siri model + status
    S-->>C: 200 OK (JSON Departures)
```

Update the `SiriClient` to handle HTTP requests more robustly and
securely.

-   Move authentication from the URL to **HTTP Basic Auth** headers.
-   Introduce a `http.Client` with a **10-second timeout** to prevent
    hanging requests.
-   Internalize `previewInterval` and `maximumStopVisits` as struct
    fields for better configuration management.
-   Switch to `http.NewRequest` to allow custom header initialization.

```mermaid
sequenceDiagram
    participant App
    participant Client as SiriClient
    participant API as TransportAPI
    App->>Client: GetStopMonitoring(ref)
    Note over Client: Prepare XML body
    Client->>Client: Create Request
    Client->>Client: Set Basic Auth Header
    Client->>API: POST /nextbuses (10s timeout)
    API-->>Client: XML Response
    Client-->>App: Siri Data
```

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

0 of 104 new or added lines in 3 files covered. (0.0%)

159 of 956 relevant lines covered (16.63%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/api_server.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc