@spasea/uz-booking-client
Version:
Unofficial UZ api client
40 lines (39 loc) • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const requestable_1 = require("../lib/requestable");
class Wagon 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);
}
/**
* Find station by name
* @param {number} from - departure station id
* @param {number} to - target station id
* @param {string} date - departure date
* @param {string} trainNumber - train number
* @param {string} wagonType - wagon type
* @param {Function} callback - callback function
* @returns {Promise} - the promise for the http request
*/
list(from, to, date, trainNumber, wagonType,
// tslint:disable-next-line
callback) {
return this.request('POST', '', {
data: {
date,
from_code: from,
to_code: to,
train: trainNumber,
},
tran_id: 'wagons',
}, 'json', false, callback);
}
}
exports.default = Wagon;