From 19b408b24040138a8e661974ff8137b493a2e09a Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 5 Jul 2024 06:30:06 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#94)
---
api.md | 8 +-
src/index.ts | 8 +-
src/resources/arrival-and-departure.ts | 939 +++++++++---------
src/resources/index.ts | 8 +-
.../arrival-and-departure.test.ts | 60 +-
5 files changed, 510 insertions(+), 513 deletions(-)
diff --git a/api.md b/api.md
index 79bc2c7..9febf06 100644
--- a/api.md
+++ b/api.md
@@ -69,13 +69,13 @@ Methods:
Types:
-- ArrivalAndDepartureSearchAllForStopResponse
-- ArrivalAndDepartureSearchForStopResponse
+- ArrivalAndDepartureRetrieveResponse
+- ArrivalAndDepartureListResponse
Methods:
-- client.arrivalAndDeparture.searchAllForStop(stopId, { ...params }) -> ArrivalAndDepartureSearchAllForStopResponse
-- client.arrivalAndDeparture.searchForStop(stopId, { ...params }) -> ArrivalAndDepartureSearchForStopResponse
+- client.arrivalAndDeparture.retrieve(stopId, { ...params }) -> ArrivalAndDepartureRetrieveResponse
+- client.arrivalAndDeparture.list(stopId, { ...params }) -> ArrivalAndDepartureListResponse
# Trip
diff --git a/src/index.ts b/src/index.ts
index 9060c8d..6941ac4 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -209,10 +209,10 @@ export namespace OnebusawaySDK {
export import RouteRetrieveResponse = API.RouteRetrieveResponse;
export import ArrivalAndDeparture = API.ArrivalAndDeparture;
- export import ArrivalAndDepartureSearchAllForStopResponse = API.ArrivalAndDepartureSearchAllForStopResponse;
- export import ArrivalAndDepartureSearchForStopResponse = API.ArrivalAndDepartureSearchForStopResponse;
- export import ArrivalAndDepartureSearchAllForStopParams = API.ArrivalAndDepartureSearchAllForStopParams;
- export import ArrivalAndDepartureSearchForStopParams = API.ArrivalAndDepartureSearchForStopParams;
+ export import ArrivalAndDepartureRetrieveResponse = API.ArrivalAndDepartureRetrieveResponse;
+ export import ArrivalAndDepartureListResponse = API.ArrivalAndDepartureListResponse;
+ export import ArrivalAndDepartureRetrieveParams = API.ArrivalAndDepartureRetrieveParams;
+ export import ArrivalAndDepartureListParams = API.ArrivalAndDepartureListParams;
export import Trip = API.Trip;
export import TripRetrieveResponse = API.TripRetrieveResponse;
diff --git a/src/resources/arrival-and-departure.ts b/src/resources/arrival-and-departure.ts
index dc2b950..9dd4842 100644
--- a/src/resources/arrival-and-departure.ts
+++ b/src/resources/arrival-and-departure.ts
@@ -8,424 +8,42 @@ import * as Shared from './shared';
export class ArrivalAndDeparture extends APIResource {
/**
- * arrivals-and-departures-for-stop
- */
- searchAllForStop(
- stopId: string,
- query?: ArrivalAndDepartureSearchAllForStopParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise;
- searchAllForStop(
- stopId: string,
- options?: Core.RequestOptions,
- ): Core.APIPromise;
- searchAllForStop(
- stopId: string,
- query: ArrivalAndDepartureSearchAllForStopParams | Core.RequestOptions = {},
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- if (isRequestOptions(query)) {
- return this.searchAllForStop(stopId, {}, query);
- }
- return this._client.get(`/api/where/arrivals-and-departures-for-stop/stopID.json`, { query, ...options });
- }
-
- /**
- * arrival-and-departure-for-stop
- */
- searchForStop(
- stopId: string,
- query: ArrivalAndDepartureSearchForStopParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return this._client.get(`/api/where/arrival-and-departure-for-stop/stopID.json`, { query, ...options });
- }
-}
-
-export interface ArrivalAndDepartureSearchAllForStopResponse extends Shared.ResponseWrapper {
- data?: ArrivalAndDepartureSearchAllForStopResponse.Data;
-}
-
-export namespace ArrivalAndDepartureSearchAllForStopResponse {
- export interface Data {
- entry?: Data.Entry;
-
- references?: Shared.References;
- }
-
- export namespace Data {
- export interface Entry {
- arrivalsAndDepartures?: Array;
- }
-
- export namespace Entry {
- export interface ArrivalsAndDeparture {
- /**
- * The actual track information of the arriving transit vehicle.
- */
- actualTrack?: string;
-
- /**
- * Indicates if riders can arrive on this transit vehicle.
- */
- arrivalEnabled?: boolean;
-
- /**
- * Index of this arrival’s trip into the sequence of trips for the active block.
- */
- blockTripSequence?: number;
-
- /**
- * Indicates if riders can depart from this transit vehicle.
- */
- departureEnabled?: boolean;
-
- /**
- * Distance of the arriving transit vehicle from the stop, in meters.
- */
- distanceFromStop?: number;
-
- /**
- * Information about frequency-based scheduling, if applicable to the trip.
- */
- frequency?: string;
-
- /**
- * Historical occupancy information of the transit vehicle.
- */
- historicalOccupancy?: string;
-
- /**
- * Timestamp of the last update time for this arrival.
- */
- lastUpdateTime?: number;
-
- /**
- * Number of stops between the arriving transit vehicle and the current stop
- * (excluding the current stop).
- */
- numberOfStopsAway?: number;
-
- /**
- * Current occupancy status of the transit vehicle.
- */
- occupancyStatus?: string;
-
- /**
- * Indicates if real-time arrival info is available for this trip.
- */
- predicted?: boolean;
-
- /**
- * Interval for predicted arrival time, if available.
- */
- predictedArrivalInterval?: string;
-
- /**
- * Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time
- * available).
- */
- predictedArrivalTime?: number;
-
- /**
- * Interval for predicted departure time, if available.
- */
- predictedDepartureInterval?: string;
-
- /**
- * Predicted departure time, in milliseconds since Unix epoch (zero if no real-time
- * available).
- */
- predictedDepartureTime?: number;
-
- /**
- * Predicted occupancy status of the transit vehicle.
- */
- predictedOccupancy?: string;
-
- /**
- * The ID of the route for the arriving vehicle.
- */
- routeId?: string;
-
- /**
- * Optional route long name that potentially overrides the route long name in the
- * referenced route element.
- */
- routeLongName?: string;
-
- /**
- * Optional route short name that potentially overrides the route short name in the
- * referenced route element.
- */
- routeShortName?: string;
-
- /**
- * Interval for scheduled arrival time.
- */
- scheduledArrivalInterval?: string;
-
- /**
- * Scheduled arrival time, in milliseconds since Unix epoch.
- */
- scheduledArrivalTime?: number;
-
- /**
- * Interval for scheduled departure time.
- */
- scheduledDepartureInterval?: string;
-
- /**
- * Scheduled departure time, in milliseconds since Unix epoch.
- */
- scheduledDepartureTime?: number;
-
- /**
- * Scheduled track information of the arriving transit vehicle.
- */
- scheduledTrack?: string;
-
- /**
- * Time, in milliseconds since the Unix epoch, of midnight for the start of the
- * service date for the trip.
- */
- serviceDate?: number;
-
- /**
- * References to situation elements (if any) applicable to this arrival.
- */
- situationIds?: Array;
-
- /**
- * Current status of the arrival.
- */
- status?: string;
-
- /**
- * The ID of the stop the vehicle is arriving at.
- */
- stopId?: string;
-
- /**
- * Index of the stop into the sequence of stops that make up the trip for this
- * arrival.
- */
- stopSequence?: number;
-
- /**
- * Total number of stops visited on the trip for this arrival.
- */
- totalStopsInTrip?: number;
-
- /**
- * Optional trip headsign that potentially overrides the trip headsign in the
- * referenced trip element.
- */
- tripHeadsign?: string;
-
- /**
- * The ID of the trip for the arriving vehicle.
- */
- tripId?: string;
-
- /**
- * Trip-specific status for the arriving transit vehicle.
- */
- tripStatus?: ArrivalsAndDeparture.TripStatus;
-
- /**
- * ID of the transit vehicle serving this trip.
- */
- vehicleId?: string;
- }
-
- export namespace ArrivalsAndDeparture {
- /**
- * Trip-specific status for the arriving transit vehicle.
- */
- export interface TripStatus {
- /**
- * Trip ID of the trip the vehicle is actively serving.
- */
- activeTripId?: string;
-
- /**
- * Index of the active trip into the sequence of trips for the active block.
- */
- blockTripSequence?: number;
-
- /**
- * ID of the closest stop to the current location of the transit vehicle.
- */
- closestStop?: string;
-
- /**
- * Time offset from the closest stop to the current position of the transit vehicle
- * (in seconds).
- */
- closestStopTimeOffset?: number;
-
- /**
- * Distance, in meters, the transit vehicle has progressed along the active trip.
- */
- distanceAlongTrip?: number;
-
- /**
- * Information about frequency-based scheduling, if applicable to the trip.
- */
- frequency?: string;
-
- /**
- * Last known distance along the trip received in real-time from the transit
- * vehicle.
- */
- lastKnownDistanceAlongTrip?: number;
-
- /**
- * Last known location of the transit vehicle.
- */
- lastKnownLocation?: TripStatus.LastKnownLocation;
-
- /**
- * Last known orientation value received in real-time from the transit vehicle.
- */
- lastKnownOrientation?: number;
-
- /**
- * Timestamp of the last known real-time location update from the transit vehicle.
- */
- lastLocationUpdateTime?: number;
-
- /**
- * Timestamp of the last known real-time update from the transit vehicle.
- */
- lastUpdateTime?: number;
-
- /**
- * ID of the next stop the transit vehicle is scheduled to arrive at.
- */
- nextStop?: string;
-
- /**
- * Time offset from the next stop to the current position of the transit vehicle
- * (in seconds).
- */
- nextStopTimeOffset?: number;
-
- /**
- * Capacity of the transit vehicle in terms of occupancy.
- */
- occupancyCapacity?: number;
-
- /**
- * Current count of occupants in the transit vehicle.
- */
- occupancyCount?: number;
-
- /**
- * Current occupancy status of the transit vehicle.
- */
- occupancyStatus?: string;
-
- /**
- * Orientation of the transit vehicle, represented as an angle in degrees.
- */
- orientation?: number;
-
- /**
- * Current journey phase of the trip.
- */
- phase?: string;
-
- /**
- * Current position of the transit vehicle.
- */
- position?: TripStatus.Position;
-
- /**
- * Indicates if real-time arrival info is available for this trip.
- */
- predicted?: boolean;
-
- /**
- * Distance, in meters, the transit vehicle is scheduled to have progressed along
- * the active trip.
- */
- scheduledDistanceAlongTrip?: number;
-
- /**
- * Deviation from the schedule in seconds (positive for late, negative for early).
- */
- scheduleDeviation?: number;
-
- /**
- * Time, in milliseconds since the Unix epoch, of midnight for the start of the
- * service date for the trip.
- */
- serviceDate?: number;
-
- /**
- * References to situation elements (if any) applicable to this trip.
- */
- situationIds?: Array;
-
- /**
- * Current status modifiers for the trip.
- */
- status?: string;
-
- /**
- * Total length of the trip, in meters.
- */
- totalDistanceAlongTrip?: number;
-
- /**
- * ID of the transit vehicle currently serving the trip.
- */
- vehicleId?: string;
- }
-
- export namespace TripStatus {
- /**
- * Last known location of the transit vehicle.
- */
- export interface LastKnownLocation {
- /**
- * Latitude of the last known location of the transit vehicle.
- */
- lat?: number;
-
- /**
- * Longitude of the last known location of the transit vehicle.
- */
- lon?: number;
- }
-
- /**
- * Current position of the transit vehicle.
- */
- export interface Position {
- /**
- * Latitude of the current position of the transit vehicle.
- */
- lat?: number;
+ * arrival-and-departure-for-stop
+ */
+ retrieve(
+ stopId: string,
+ query: ArrivalAndDepartureRetrieveParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.get(`/api/where/arrival-and-departure-for-stop/stopID.json`, { query, ...options });
+ }
- /**
- * Longitude of the current position of the transit vehicle.
- */
- lon?: number;
- }
- }
- }
+ /**
+ * arrivals-and-departures-for-stop
+ */
+ list(
+ stopId: string,
+ query?: ArrivalAndDepartureListParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise;
+ list(stopId: string, options?: Core.RequestOptions): Core.APIPromise;
+ list(
+ stopId: string,
+ query: ArrivalAndDepartureListParams | Core.RequestOptions = {},
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ if (isRequestOptions(query)) {
+ return this.list(stopId, {}, query);
}
+ return this._client.get(`/api/where/arrivals-and-departures-for-stop/stopID.json`, { query, ...options });
}
}
-export interface ArrivalAndDepartureSearchForStopResponse extends Shared.ResponseWrapper {
- data?: ArrivalAndDepartureSearchForStopResponse.Data;
+export interface ArrivalAndDepartureRetrieveResponse extends Shared.ResponseWrapper {
+ data?: ArrivalAndDepartureRetrieveResponse.Data;
}
-export namespace ArrivalAndDepartureSearchForStopResponse {
+export namespace ArrivalAndDepartureRetrieveResponse {
export interface Data {
entry?: Data.Entry;
@@ -689,112 +307,503 @@ export namespace ArrivalAndDepartureSearchForStopResponse {
/**
* Capacity of the transit vehicle in terms of occupancy.
*/
- occupancyCapacity?: number;
+ occupancyCapacity?: number;
+
+ /**
+ * Current count of occupants in the transit vehicle.
+ */
+ occupancyCount?: number;
+
+ /**
+ * Current occupancy status of the transit vehicle.
+ */
+ occupancyStatus?: string;
+
+ /**
+ * Orientation of the transit vehicle, represented as an angle in degrees.
+ */
+ orientation?: number;
+
+ /**
+ * Current journey phase of the trip.
+ */
+ phase?: string;
+
+ /**
+ * Current position of the transit vehicle.
+ */
+ position?: TripStatus.Position;
+
+ /**
+ * Indicates if real-time arrival info is available for this trip.
+ */
+ predicted?: boolean;
+
+ /**
+ * Distance, in meters, the transit vehicle is scheduled to have progressed along
+ * the active trip.
+ */
+ scheduledDistanceAlongTrip?: number;
+
+ /**
+ * Deviation from the schedule in seconds (positive for late, negative for early).
+ */
+ scheduleDeviation?: number;
+
+ /**
+ * Time, in milliseconds since the Unix epoch, of midnight for the start of the
+ * service date for the trip.
+ */
+ serviceDate?: number;
+
+ /**
+ * References to situation elements (if any) applicable to this trip.
+ */
+ situationIds?: Array;
+
+ /**
+ * Current status modifiers for the trip.
+ */
+ status?: string;
+
+ /**
+ * Total length of the trip, in meters.
+ */
+ totalDistanceAlongTrip?: number;
+
+ /**
+ * ID of the transit vehicle currently serving the trip.
+ */
+ vehicleId?: string;
+ }
+
+ export namespace TripStatus {
+ /**
+ * Last known location of the transit vehicle.
+ */
+ export interface LastKnownLocation {
+ /**
+ * Latitude of the last known location of the transit vehicle.
+ */
+ lat?: number;
+
+ /**
+ * Longitude of the last known location of the transit vehicle.
+ */
+ lon?: number;
+ }
+
+ /**
+ * Current position of the transit vehicle.
+ */
+ export interface Position {
+ /**
+ * Latitude of the current position of the transit vehicle.
+ */
+ lat?: number;
+
+ /**
+ * Longitude of the current position of the transit vehicle.
+ */
+ lon?: number;
+ }
+ }
+ }
+ }
+}
+
+export interface ArrivalAndDepartureListResponse extends Shared.ResponseWrapper {
+ data?: ArrivalAndDepartureListResponse.Data;
+}
+
+export namespace ArrivalAndDepartureListResponse {
+ export interface Data {
+ entry?: Data.Entry;
+
+ references?: Shared.References;
+ }
+
+ export namespace Data {
+ export interface Entry {
+ arrivalsAndDepartures?: Array;
+ }
+
+ export namespace Entry {
+ export interface ArrivalsAndDeparture {
+ /**
+ * The actual track information of the arriving transit vehicle.
+ */
+ actualTrack?: string;
+
+ /**
+ * Indicates if riders can arrive on this transit vehicle.
+ */
+ arrivalEnabled?: boolean;
+
+ /**
+ * Index of this arrival’s trip into the sequence of trips for the active block.
+ */
+ blockTripSequence?: number;
+
+ /**
+ * Indicates if riders can depart from this transit vehicle.
+ */
+ departureEnabled?: boolean;
+
+ /**
+ * Distance of the arriving transit vehicle from the stop, in meters.
+ */
+ distanceFromStop?: number;
+
+ /**
+ * Information about frequency-based scheduling, if applicable to the trip.
+ */
+ frequency?: string;
+
+ /**
+ * Historical occupancy information of the transit vehicle.
+ */
+ historicalOccupancy?: string;
+
+ /**
+ * Timestamp of the last update time for this arrival.
+ */
+ lastUpdateTime?: number;
+
+ /**
+ * Number of stops between the arriving transit vehicle and the current stop
+ * (excluding the current stop).
+ */
+ numberOfStopsAway?: number;
+
+ /**
+ * Current occupancy status of the transit vehicle.
+ */
+ occupancyStatus?: string;
+
+ /**
+ * Indicates if real-time arrival info is available for this trip.
+ */
+ predicted?: boolean;
+
+ /**
+ * Interval for predicted arrival time, if available.
+ */
+ predictedArrivalInterval?: string;
+
+ /**
+ * Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time
+ * available).
+ */
+ predictedArrivalTime?: number;
+
+ /**
+ * Interval for predicted departure time, if available.
+ */
+ predictedDepartureInterval?: string;
+
+ /**
+ * Predicted departure time, in milliseconds since Unix epoch (zero if no real-time
+ * available).
+ */
+ predictedDepartureTime?: number;
+
+ /**
+ * Predicted occupancy status of the transit vehicle.
+ */
+ predictedOccupancy?: string;
+
+ /**
+ * The ID of the route for the arriving vehicle.
+ */
+ routeId?: string;
+
+ /**
+ * Optional route long name that potentially overrides the route long name in the
+ * referenced route element.
+ */
+ routeLongName?: string;
+
+ /**
+ * Optional route short name that potentially overrides the route short name in the
+ * referenced route element.
+ */
+ routeShortName?: string;
+
+ /**
+ * Interval for scheduled arrival time.
+ */
+ scheduledArrivalInterval?: string;
+
+ /**
+ * Scheduled arrival time, in milliseconds since Unix epoch.
+ */
+ scheduledArrivalTime?: number;
/**
- * Current count of occupants in the transit vehicle.
+ * Interval for scheduled departure time.
*/
- occupancyCount?: number;
+ scheduledDepartureInterval?: string;
/**
- * Current occupancy status of the transit vehicle.
+ * Scheduled departure time, in milliseconds since Unix epoch.
*/
- occupancyStatus?: string;
+ scheduledDepartureTime?: number;
/**
- * Orientation of the transit vehicle, represented as an angle in degrees.
+ * Scheduled track information of the arriving transit vehicle.
*/
- orientation?: number;
+ scheduledTrack?: string;
/**
- * Current journey phase of the trip.
+ * Time, in milliseconds since the Unix epoch, of midnight for the start of the
+ * service date for the trip.
*/
- phase?: string;
+ serviceDate?: number;
/**
- * Current position of the transit vehicle.
+ * References to situation elements (if any) applicable to this arrival.
*/
- position?: TripStatus.Position;
+ situationIds?: Array;
/**
- * Indicates if real-time arrival info is available for this trip.
+ * Current status of the arrival.
*/
- predicted?: boolean;
+ status?: string;
/**
- * Distance, in meters, the transit vehicle is scheduled to have progressed along
- * the active trip.
+ * The ID of the stop the vehicle is arriving at.
*/
- scheduledDistanceAlongTrip?: number;
+ stopId?: string;
/**
- * Deviation from the schedule in seconds (positive for late, negative for early).
+ * Index of the stop into the sequence of stops that make up the trip for this
+ * arrival.
*/
- scheduleDeviation?: number;
+ stopSequence?: number;
/**
- * Time, in milliseconds since the Unix epoch, of midnight for the start of the
- * service date for the trip.
+ * Total number of stops visited on the trip for this arrival.
*/
- serviceDate?: number;
+ totalStopsInTrip?: number;
/**
- * References to situation elements (if any) applicable to this trip.
+ * Optional trip headsign that potentially overrides the trip headsign in the
+ * referenced trip element.
*/
- situationIds?: Array;
+ tripHeadsign?: string;
/**
- * Current status modifiers for the trip.
+ * The ID of the trip for the arriving vehicle.
*/
- status?: string;
+ tripId?: string;
/**
- * Total length of the trip, in meters.
+ * Trip-specific status for the arriving transit vehicle.
*/
- totalDistanceAlongTrip?: number;
+ tripStatus?: ArrivalsAndDeparture.TripStatus;
/**
- * ID of the transit vehicle currently serving the trip.
+ * ID of the transit vehicle serving this trip.
*/
vehicleId?: string;
}
- export namespace TripStatus {
+ export namespace ArrivalsAndDeparture {
/**
- * Last known location of the transit vehicle.
+ * Trip-specific status for the arriving transit vehicle.
*/
- export interface LastKnownLocation {
+ export interface TripStatus {
/**
- * Latitude of the last known location of the transit vehicle.
+ * Trip ID of the trip the vehicle is actively serving.
*/
- lat?: number;
+ activeTripId?: string;
/**
- * Longitude of the last known location of the transit vehicle.
+ * Index of the active trip into the sequence of trips for the active block.
*/
- lon?: number;
+ blockTripSequence?: number;
+
+ /**
+ * ID of the closest stop to the current location of the transit vehicle.
+ */
+ closestStop?: string;
+
+ /**
+ * Time offset from the closest stop to the current position of the transit vehicle
+ * (in seconds).
+ */
+ closestStopTimeOffset?: number;
+
+ /**
+ * Distance, in meters, the transit vehicle has progressed along the active trip.
+ */
+ distanceAlongTrip?: number;
+
+ /**
+ * Information about frequency-based scheduling, if applicable to the trip.
+ */
+ frequency?: string;
+
+ /**
+ * Last known distance along the trip received in real-time from the transit
+ * vehicle.
+ */
+ lastKnownDistanceAlongTrip?: number;
+
+ /**
+ * Last known location of the transit vehicle.
+ */
+ lastKnownLocation?: TripStatus.LastKnownLocation;
+
+ /**
+ * Last known orientation value received in real-time from the transit vehicle.
+ */
+ lastKnownOrientation?: number;
+
+ /**
+ * Timestamp of the last known real-time location update from the transit vehicle.
+ */
+ lastLocationUpdateTime?: number;
+
+ /**
+ * Timestamp of the last known real-time update from the transit vehicle.
+ */
+ lastUpdateTime?: number;
+
+ /**
+ * ID of the next stop the transit vehicle is scheduled to arrive at.
+ */
+ nextStop?: string;
+
+ /**
+ * Time offset from the next stop to the current position of the transit vehicle
+ * (in seconds).
+ */
+ nextStopTimeOffset?: number;
+
+ /**
+ * Capacity of the transit vehicle in terms of occupancy.
+ */
+ occupancyCapacity?: number;
+
+ /**
+ * Current count of occupants in the transit vehicle.
+ */
+ occupancyCount?: number;
+
+ /**
+ * Current occupancy status of the transit vehicle.
+ */
+ occupancyStatus?: string;
+
+ /**
+ * Orientation of the transit vehicle, represented as an angle in degrees.
+ */
+ orientation?: number;
+
+ /**
+ * Current journey phase of the trip.
+ */
+ phase?: string;
+
+ /**
+ * Current position of the transit vehicle.
+ */
+ position?: TripStatus.Position;
+
+ /**
+ * Indicates if real-time arrival info is available for this trip.
+ */
+ predicted?: boolean;
+
+ /**
+ * Distance, in meters, the transit vehicle is scheduled to have progressed along
+ * the active trip.
+ */
+ scheduledDistanceAlongTrip?: number;
+
+ /**
+ * Deviation from the schedule in seconds (positive for late, negative for early).
+ */
+ scheduleDeviation?: number;
+
+ /**
+ * Time, in milliseconds since the Unix epoch, of midnight for the start of the
+ * service date for the trip.
+ */
+ serviceDate?: number;
+
+ /**
+ * References to situation elements (if any) applicable to this trip.
+ */
+ situationIds?: Array;
+
+ /**
+ * Current status modifiers for the trip.
+ */
+ status?: string;
+
+ /**
+ * Total length of the trip, in meters.
+ */
+ totalDistanceAlongTrip?: number;
+
+ /**
+ * ID of the transit vehicle currently serving the trip.
+ */
+ vehicleId?: string;
}
- /**
- * Current position of the transit vehicle.
- */
- export interface Position {
+ export namespace TripStatus {
/**
- * Latitude of the current position of the transit vehicle.
+ * Last known location of the transit vehicle.
*/
- lat?: number;
+ export interface LastKnownLocation {
+ /**
+ * Latitude of the last known location of the transit vehicle.
+ */
+ lat?: number;
+
+ /**
+ * Longitude of the last known location of the transit vehicle.
+ */
+ lon?: number;
+ }
/**
- * Longitude of the current position of the transit vehicle.
+ * Current position of the transit vehicle.
*/
- lon?: number;
+ export interface Position {
+ /**
+ * Latitude of the current position of the transit vehicle.
+ */
+ lat?: number;
+
+ /**
+ * Longitude of the current position of the transit vehicle.
+ */
+ lon?: number;
+ }
}
}
}
}
}
-export interface ArrivalAndDepartureSearchAllForStopParams {
+export interface ArrivalAndDepartureRetrieveParams {
+ serviceDate: number;
+
+ tripId: string;
+
+ stopSequence?: number;
+
+ time?: number;
+
+ vehicleId?: string;
+}
+
+export interface ArrivalAndDepartureListParams {
/**
* Include vehicles arriving or departing in the next n minutes.
*/
@@ -811,21 +820,9 @@ export interface ArrivalAndDepartureSearchAllForStopParams {
time?: string;
}
-export interface ArrivalAndDepartureSearchForStopParams {
- serviceDate: number;
-
- tripId: string;
-
- stopSequence?: number;
-
- time?: number;
-
- vehicleId?: string;
-}
-
export namespace ArrivalAndDeparture {
- export import ArrivalAndDepartureSearchAllForStopResponse = ArrivalAndDepartureAPI.ArrivalAndDepartureSearchAllForStopResponse;
- export import ArrivalAndDepartureSearchForStopResponse = ArrivalAndDepartureAPI.ArrivalAndDepartureSearchForStopResponse;
- export import ArrivalAndDepartureSearchAllForStopParams = ArrivalAndDepartureAPI.ArrivalAndDepartureSearchAllForStopParams;
- export import ArrivalAndDepartureSearchForStopParams = ArrivalAndDepartureAPI.ArrivalAndDepartureSearchForStopParams;
+ export import ArrivalAndDepartureRetrieveResponse = ArrivalAndDepartureAPI.ArrivalAndDepartureRetrieveResponse;
+ export import ArrivalAndDepartureListResponse = ArrivalAndDepartureAPI.ArrivalAndDepartureListResponse;
+ export import ArrivalAndDepartureRetrieveParams = ArrivalAndDepartureAPI.ArrivalAndDepartureRetrieveParams;
+ export import ArrivalAndDepartureListParams = ArrivalAndDepartureAPI.ArrivalAndDepartureListParams;
}
diff --git a/src/resources/index.ts b/src/resources/index.ts
index 6c47955..1b9cfc2 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -4,10 +4,10 @@ export * from './shared';
export { AgenciesWithCoverageRetrieveResponse, AgenciesWithCoverage } from './agencies-with-coverage';
export { AgencyRetrieveResponse, Agency } from './agency';
export {
- ArrivalAndDepartureSearchAllForStopResponse,
- ArrivalAndDepartureSearchForStopResponse,
- ArrivalAndDepartureSearchAllForStopParams,
- ArrivalAndDepartureSearchForStopParams,
+ ArrivalAndDepartureRetrieveResponse,
+ ArrivalAndDepartureListResponse,
+ ArrivalAndDepartureRetrieveParams,
+ ArrivalAndDepartureListParams,
ArrivalAndDeparture,
} from './arrival-and-departure';
export { ConfigRetrieveResponse, Config } from './config';
diff --git a/tests/api-resources/arrival-and-departure.test.ts b/tests/api-resources/arrival-and-departure.test.ts
index 9a42f73..08e0fd0 100644
--- a/tests/api-resources/arrival-and-departure.test.ts
+++ b/tests/api-resources/arrival-and-departure.test.ts
@@ -9,8 +9,11 @@ const onebusawaySDK = new OnebusawaySDK({
});
describe('resource arrivalAndDeparture', () => {
- test('searchAllForStop', async () => {
- const responsePromise = onebusawaySDK.arrivalAndDeparture.searchAllForStop('1_75403');
+ test('retrieve: only required params', async () => {
+ const responsePromise = onebusawaySDK.arrivalAndDeparture.retrieve('1_75403', {
+ serviceDate: 0,
+ tripId: 'string',
+ });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -20,29 +23,18 @@ describe('resource arrivalAndDeparture', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('searchAllForStop: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- onebusawaySDK.arrivalAndDeparture.searchAllForStop('1_75403', { path: '/_stainless_unknown_path' }),
- ).rejects.toThrow(OnebusawaySDK.NotFoundError);
- });
-
- test('searchAllForStop: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- onebusawaySDK.arrivalAndDeparture.searchAllForStop(
- '1_75403',
- { minutesAfter: 0, minutesBefore: 0, time: '2019-12-27T18:11:19.117Z' },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(OnebusawaySDK.NotFoundError);
- });
-
- test('searchForStop: only required params', async () => {
- const responsePromise = onebusawaySDK.arrivalAndDeparture.searchForStop('1_75403', {
+ test('retrieve: required and optional params', async () => {
+ const response = await onebusawaySDK.arrivalAndDeparture.retrieve('1_75403', {
serviceDate: 0,
tripId: 'string',
+ stopSequence: 0,
+ time: 0,
+ vehicleId: 'string',
});
+ });
+
+ test('list', async () => {
+ const responsePromise = onebusawaySDK.arrivalAndDeparture.list('1_75403');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -52,13 +44,21 @@ describe('resource arrivalAndDeparture', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('searchForStop: required and optional params', async () => {
- const response = await onebusawaySDK.arrivalAndDeparture.searchForStop('1_75403', {
- serviceDate: 0,
- tripId: 'string',
- stopSequence: 0,
- time: 0,
- vehicleId: 'string',
- });
+ test('list: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ onebusawaySDK.arrivalAndDeparture.list('1_75403', { path: '/_stainless_unknown_path' }),
+ ).rejects.toThrow(OnebusawaySDK.NotFoundError);
+ });
+
+ test('list: request options and params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ onebusawaySDK.arrivalAndDeparture.list(
+ '1_75403',
+ { minutesAfter: 0, minutesBefore: 0, time: '2019-12-27T18:11:19.117Z' },
+ { path: '/_stainless_unknown_path' },
+ ),
+ ).rejects.toThrow(OnebusawaySDK.NotFoundError);
});
});