This commit is contained in:
parent
a5337323c7
commit
c1406a3e34
@ -1,3 +1,5 @@
|
||||
import { GenericV2_ApiResponse } from "../types/generic/GenericTypesV2";
|
||||
import { LdbV2_Staff } from "../types/ldb/LdbTypesV2";
|
||||
import { BaseOwlBoardClient } from "./client";
|
||||
|
||||
export class LdbClientV2 {
|
||||
@ -6,4 +8,24 @@ export class LdbClientV2 {
|
||||
constructor(client: BaseOwlBoardClient) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
async getStaffLdb(station: string): Promise<GenericV2_ApiResponse<LdbV2_Staff>> {
|
||||
// Validate needs to accept TIPLOC or 3ALPHA
|
||||
const path = `/api/v2/live/station/${station}/staff`;
|
||||
return this.client.makeRequest("GET", path);
|
||||
}
|
||||
|
||||
// async getPublicLdb(station: string): Promise<LdbV2_Public> {}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Calls to include:
|
||||
|
||||
[X] Staff LDB
|
||||
[] Public LDB
|
||||
[] Get Service by RID
|
||||
[] Get Service by 'Other?'
|
||||
[] Get nearest stations
|
||||
|
||||
*/
|
5
src/types/generic/GenericTypesV2.ts
Normal file
5
src/types/generic/GenericTypesV2.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface GenericV2_ApiResponse<T> {
|
||||
obStatus: number,
|
||||
obMsg: string,
|
||||
data?: T
|
||||
}
|
47
src/types/ldb/LdbTypesV2.ts
Normal file
47
src/types/ldb/LdbTypesV2.ts
Normal file
@ -0,0 +1,47 @@
|
||||
export interface LdbV2_Staff {
|
||||
generatedAt: Date;
|
||||
locationName: string;
|
||||
stationManagerCode: string;
|
||||
nrccMessages?: LdbV2_StaffNrccMessage[];
|
||||
trainServices?: LdbV2_StaffTrainServices[];
|
||||
busServices?: LdbV2_StaffTrainServices[];
|
||||
ferryServices?: LdbV2_StaffTrainServices[];
|
||||
}
|
||||
|
||||
export interface LdbV2_StaffNrccMessage {
|
||||
severity: string;
|
||||
xhtmlMessage: string;
|
||||
}
|
||||
|
||||
export interface LdbV2_StaffTrainServices {
|
||||
rid: string;
|
||||
uid: string;
|
||||
trainid: string;
|
||||
operatorCode: string;
|
||||
isPassengerService?: string;
|
||||
platform?: string;
|
||||
platformIsHidden?: string;
|
||||
serviceIsSupressed?: string;
|
||||
origin: LdbV2_ServiceLocation[];
|
||||
destination: LdbV2_ServiceLocation[];
|
||||
length?: number;
|
||||
isCancelled?: string;
|
||||
cancelReason?: string;
|
||||
delayReason?: string;
|
||||
arrivalType?: string;
|
||||
departureType?: string;
|
||||
sta?: Date | string;
|
||||
eta?: Date | string;
|
||||
ata?: Date | string;
|
||||
std?: Date | string;
|
||||
etd?: Date | string;
|
||||
atd?: Date | string;
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface LdbV2_ServiceLocation {
|
||||
tiploc: string;
|
||||
name?: string;
|
||||
via?: string;
|
||||
}
|
@ -50,7 +50,7 @@
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user