From c5f5b07ddbd1a61c9d48b1b8fa0849dbfd458f46 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 12 Oct 2023 20:45:26 +0100 Subject: [PATCH] Add types for new trainService(Timetable) data --- index.ts | 2 ++ src/owlboardApi/pis.ts | 13 +++++++++++++ src/owlboardApi/trainTimetable.ts | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/owlboardApi/pis.ts create mode 100644 src/owlboardApi/trainTimetable.ts diff --git a/index.ts b/index.ts index f9a8ce9..04a2870 100644 --- a/index.ts +++ b/index.ts @@ -11,5 +11,7 @@ export { ApiResponse } from './src/owlboardApi/apiResponse' export { Versions } from './src/owlboardApi/versions' export { StaffLdb, NrccMessage, TrainServices, ServiceLocation } from './src/owlboardApi/staffLdb' +export { OB_TrainTT_service, OB_TrainTT_stopDetail } from './src/owlboardApi/trainTimetable' +export { OB_Pis_SimpleObject } from './src/owlboardApi/pis' // Upstream API \ No newline at end of file diff --git a/src/owlboardApi/pis.ts b/src/owlboardApi/pis.ts new file mode 100644 index 0000000..b0dd1c8 --- /dev/null +++ b/src/owlboardApi/pis.ts @@ -0,0 +1,13 @@ +export interface OB_Pis_SimpleObject { + code: number; + match: "full" | "partial"; + msg: string; +} + +/* NOT IN USE YET +export interface OB_Pis_FullObject { + code: number; + crs: string[]; + tiploc?: string[]; +} +*/ \ No newline at end of file diff --git a/src/owlboardApi/trainTimetable.ts b/src/owlboardApi/trainTimetable.ts new file mode 100644 index 0000000..770d7f2 --- /dev/null +++ b/src/owlboardApi/trainTimetable.ts @@ -0,0 +1,24 @@ +import type { OB_Pis_SimpleObject } from "./pis"; + +export interface OB_TrainTT_service { + stpIndicator: string; + operator: string; + trainUid: string; + headcode: string; + powerType: string; + planSpeed: number; + scheduleStart: Date; + scheduleEnd: Date; + daysRun: string[]; + stops: OB_TrainTT_stopDetail[]; + pis: OB_Pis_SimpleObject; +} + +export interface OB_TrainTT_stopDetail { + publicDeparture?: string; + publicArrival?: string; + wttDeparture?: string; + wttArrival?: string; + tiploc: string; + isPublic: boolean; +} \ No newline at end of file