Add barebones function for getServiceDetailByRID
All checks were successful
Testing / run-tests (push) Successful in 3m17s

This commit is contained in:
Fred Boniface 2025-09-09 21:03:38 +01:00
parent ca85bbd6be
commit cd2ce601c6
2 changed files with 24 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import { GenericV2_ApiResponse } from "../types/generic/GenericTypesV2";
import { LdbV2_Staff } from "../types/ldb/LdbTypesV2";
import { LdbV2_ServiceDetail, LdbV2_Staff } from "../types/ldb/LdbTypesV2";
import { BaseOwlBoardClient } from "./client";
export class LdbClientV2 {
@ -16,16 +16,21 @@ export class LdbClientV2 {
}
// async getPublicLdb(station: string): Promise<LdbV2_Public> {}
async getServiceDetailByRID(rid: string): Promise<LdbV2_ServiceDetail> {
const path = `/api/v2/live/train/rid/${rid}`;
return this.client.makeRequest("GET", path);
}
}
/*
Calls to include:
[X] Staff LDB
[] Staff LDB - Need to validate input.
[] Public LDB
[] Get Service by RID
[] Get Service by RID - NOT DONE, Types need revising on the backend.
[] Get Service by 'Other?'
[] Get nearest stations
[X] Get nearest stations -- This has been implemented in the Reference Client
*/

View File

@ -44,4 +44,19 @@ export interface LdbV2_ServiceLocation {
tiploc: string;
name?: string;
via?: string;
}
// This need improvement in the backend. Currently raw data from upstream is piped to the client
export interface LdbV2_ServiceDetail {
generatedAt: string;
rid: string;
uid: string;
trainid: string;
sdd: string;
operator: string;
operatorCode: string;
serviceType: string;
cancelReason: string;
category: string;
locations: [];
}