Add LDB and API Types

This commit is contained in:
Fred Boniface 2023-08-01 13:36:08 +01:00
parent d0b1a70e72
commit fd5acee038
4 changed files with 51 additions and 1 deletions

View File

@ -1,5 +1,5 @@
{ {
"name": "ts-types", "name": "@owlboard/ts-types",
"version": "0.0.1", "version": "0.0.1",
"description": "Declares Typescript types for the OwlBoard stack", "description": "Declares Typescript types for the OwlBoard stack",
"main": "index.js", "main": "index.js",

View File

@ -7,6 +7,9 @@ export { Service, Stop } from './database/timetable'
export { User } from './database/user' export { User } from './database/user'
// Downstream API // Downstream API
export { ApiResponse } from './owlboardApi/apiResponse'
export { Versions } from './owlboardApi/versions' export { Versions } from './owlboardApi/versions'
export { StaffLdb, NrccMessage, TrainServices,
ServiceLocation } from './owlboardApi/staffLdb'
// Upstream API // Upstream API

View File

@ -0,0 +1,5 @@
export interface ApiResponse<T> {
obStatus: number,
obMsg: string,
data?: T
}

View File

@ -0,0 +1,42 @@
export interface StaffLdb {
generatedAt: Date;
locationName: string;
stationManagerCode: string;
nrccMessages: NrccMessage[];
trainServices: TrainServices[];
}
export interface NrccMessage {
severity: string;
xhtmlMessage: string;
}
export interface TrainServices {
rid: string;
uid: string;
trainid: string;
operatorCode: string;
isPassengerService?: string;
platform?: string;
platformIsHidden?: string;
serviceIsSupressed?: string;
origin: ServiceLocation[];
destination: ServiceLocation[];
isCancelled: string;
cancelReason?: string;
delayReason?: string;
arrivalType?: string;
departureType?: string;
sta?: Date;
eta?: Date;
ata?: Date;
std?: Date;
etd?: Date;
atd?: Date;
}
export interface ServiceLocation {
tiploc: string;
name: string;
}