UNPKG

mav-api-ts

Version:

Unofficial, experimental MÁV API library based on the requests by jegy.mav.hu

22 lines (21 loc) 1.37 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTrainInfo = void 0; const requestConstants_type_1 = require("../../types/requestConstants.type"); const makeRequest_1 = require("../../utils/makeRequest"); function getTrainInfo(query, language = 'hu', axiosConfig) { return __awaiter(this, void 0, void 0, function* () { const body = Object.assign({ type: 'TrainInfo', minCount: '0', maxCount: '9999999' }, query); return (0, makeRequest_1.makeRequest)(requestConstants_type_1.ApiSection.InformationApi, requestConstants_type_1.ApiEndpoint.GetTimetable, body, language, axiosConfig); }); } exports.getTrainInfo = getTrainInfo;