Skip to content

Commit 454f266

Browse files
committed
feat: vehicle capacity info endpoint
1 parent 600236d commit 454f266

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/api.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ export async function getMapVehicles(auth: string) {
2020
return await res.json()
2121
}
2222

23+
/**
24+
* get a list of the capacity information for all active buses
25+
* @returns {VehicleCapacity[]} list of all capacity information for active buses
26+
*/
27+
export async function getVehicleCapacities() {
28+
var res = await fetch('https://ridebtd.org/Services/JSONPRelay.svc/GetVehicleCapacities')
29+
30+
return await res.json()
31+
}
32+
2333
/**
2434
* get the next stop times for a given route(s)
2535
* @param {string[]} routes route ids to get stop times for

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export {
55
export {
66
getRoutes,
77
getMapVehicles,
8+
getVehicleCapacities,
89
getStopArrivalTimes,
910
getAnnouncements
1011
} from "./api.js"

types/index.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ declare module 'brazos-transit-api' {
8383
VehicleID: number;
8484
}
8585

86+
export interface VehicleCapacity {
87+
Capacity: number;
88+
CurrentOccupation: number;
89+
Percentage: number;
90+
VehicleID: number;
91+
}
92+
8693
interface TimeEstimate {
8794
EstimateTime: string;
8895
IsArriving: boolean;
@@ -136,6 +143,12 @@ declare module 'brazos-transit-api' {
136143
*/
137144
export async function getMapVehicles(auth: string): Promise<Vehicle[]>
138145

146+
/**
147+
* get a list of the capacity information for all active buses
148+
* @returns {VehicleCapacity[]} list of all capacity information for active buses
149+
*/
150+
export async function getVehicleCapacities(): Promise<VehicleCapacity[]>
151+
139152
/**
140153
* get the next stop times for a given route(s)
141154
* @param {string[]} routes route ids to get stop times for

0 commit comments

Comments
 (0)