@spasea/uz-booking-client
Version:
Unofficial UZ api client
50 lines (49 loc) • 1.49 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const station_1 = require("./station");
const train_1 = require("./train");
const coach_1 = require("./coach");
const wagon_1 = require("./wagon");
class UZ {
/**
* Create a new UZ.
* @param {string} [lang='en'] - language
* @param {string} [apiBase='https://booking.uz.gov.ua/'] - the base UzBooking API URL
* @param {Object} [auth] - the credentials to authenticate to UzBoojking. If auth is
* not provided requests will be made unauthenticated
*/
constructor(lang, apiBase = 'https://booking.uz.gov.ua/', auth) {
this.lang = lang;
this.auth = auth;
this.apiBase = apiBase;
}
/**
* Create a new Station wrapper
* @returns {Station}
*/
get Station() {
return new station_1.default(this.lang, this.auth, this.apiBase);
}
/**
* Create a new Train wrapper
* @returns {Train}
*/
get Train() {
return new train_1.default(this.lang, this.auth, this.apiBase);
}
/**
* Create a new Wagon wrapper
* @returns {Wagon}
*/
get Wagon() {
return new wagon_1.default(this.lang, this.auth, this.apiBase);
}
/**
* Create a new Coach wrapper
* @returns {Coach}
*/
get Coach() {
return new coach_1.default(this.lang, this.auth, this.apiBase);
}
}
exports.default = UZ;