import { ApiPisObject } from '@owlboard/api-schema-types'; import type { BaseClient, ApiResult } from '../lib/base.js'; import { IsValidCrs, IsValidPis } from '../lib/validation.js'; import { ValidationError } from '../lib/errors.js'; export class PisModule { constructor(private client: BaseClient) {} async getByStartEndCrs(startCrs: string, endCrs: string): Promise> { if (!IsValidCrs(startCrs)) { throw new ValidationError("startCrs", "Invalid CRS Format") } if (!IsValidCrs(endCrs)) { throw new ValidationError("endCrs", "Invalid CRS Format") } const path = `/pis/route/${encodeURIComponent(startCrs.toUpperCase())}/${encodeURIComponent(endCrs.toUpperCase())}`; return this.client.request(path, { method: 'GET', }); } async getByCode(code: string): Promise> { if (!IsValidPis(code)) { throw new ValidationError("code", "Invalid PIS Code Format") } const path = `/pis/code/${encodeURIComponent(code)}`; return this.client.request(path, { method: 'GET', }) } }