@spasea/uz-booking-client
Version:
Unofficial UZ api client
27 lines (26 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const requestable_1 = require("../lib/requestable");
class Station extends requestable_1.default {
/**
* Construct station class.
* @param {string} [lang] - language
* @param {auth} [auth] - the credentials to authenticate to UzBoojking. If auth is
* not provided requests will be made unauthenticated
* @param {string} [apiBase] - the base UzBooking API URL
*/
constructor(lang, auth, apiBase) {
super(lang, auth, apiBase, true);
}
/**
* Find station by name
* @param {string} stationName - the name of station
* @param {Function} cb - callback function
* @returns {Promise} - the promise for the http request
*/
// tslint:disable-next-line
find(stationName, callback) {
return this.request('POST', `train_search/station/?term=${encodeURIComponent(stationName)}/`, null, 'form', false, callback);
}
}
exports.default = Station;