Implement use of a custom fetch fn
This commit is contained in:
@@ -7,7 +7,7 @@ import { ValidationError } from '../lib/errors.js';
|
||||
export class TrainsModule {
|
||||
constructor(private client: BaseClient) { }
|
||||
|
||||
async getByHeadcode(headcode: string, date: string | Date = new Date, toc: string = ""): Promise<ApiResult<ApiTrainsTrainByHeadcode.TrainByHeadcodeResponse[]>> {
|
||||
async getByHeadcode(headcode: string, date: string | Date = new Date, toc: string = "", customFetch?: typeof fetch): Promise<ApiResult<ApiTrainsTrainByHeadcode.TrainByHeadcodeResponse[]>> {
|
||||
if (!IsValidHeadcode(headcode)) {
|
||||
throw new ValidationError("headcode", "Invalid headcode format")
|
||||
}
|
||||
@@ -29,6 +29,8 @@ export class TrainsModule {
|
||||
|
||||
return this.client.request<ApiTrainsTrainByHeadcode.TrainByHeadcodeResponse[]>(path, {
|
||||
method: 'GET',
|
||||
});
|
||||
}, customFetch);
|
||||
}
|
||||
|
||||
async getByRid(rid: string, customFetch?: typeof fetch) {}
|
||||
}
|
||||
Reference in New Issue
Block a user