Generic API
Every TRIAS 1.2 service request name can be invoked with a plain object body that mirrors the XML structure you want under that request element. Subscription requests use the same idea with subscribe.
Service requests
Section titled “Service requests”const rawResponse = await client.request("StopEventRequest", { Location: { LocationRef: { StopPointRef: "de:08212:90", LocationName: { Text: "Karlsruhe Hauptbahnhof", Language: "de", }, }, DepArrTime: "2026-03-20T21:10:00+01:00", },});
console.log(rawResponse.parsed);Return type: RawTriasResponse with status, parsed (typed as unknown unless you pass a generic), and xml (response body string).
Subscription requests
Section titled “Subscription requests”await client.subscribe("TripMonitoringSubscriptionRequest", { /* subscription body */});Generic request object
Section titled “Generic request object”requestGeneric accepts { requestName, body } and delegates to request:
await client.requestGeneric({ requestName: "FacilityRequest", body: { /* ... */ },});Building XML only
Section titled “Building XML only”buildGenericServiceRequest(requestName, body, requestTimestamp?):ServiceRequestenvelopebuildGenericSubscriptionRequest(requestName, body, requestTimestamp?):SubscriptionRequestenvelope
Exported constants
Section titled “Exported constants”Import these from trias-js to drive UI, validation, or exhaustiveness checks:
TRIAS_SERVICE_REQUESTS: all supported service request names (includesLocationInformationRequest,TripRequest,StopEventRequest, etc.)TRIAS_SUBSCRIPTION_REQUESTS: subscription request namesTRIAS_VERSIONS: currently["1.2"]
TypeScript types TriasServiceRequestName and TriasSubscriptionRequestName match those arrays.