UNPKG

ngx-monitorias-uniandes-lib

Version:

This library is used for Monitorias-Uniandes system.

57 lines 3.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var url_constant_1 = require("./url-constant"); var ServiceLocator = /** @class */ (function () { function ServiceLocator() { } ServiceLocator.prototype.getHost = function (isDebug) { var host = window.location.origin; if (isDebug) { host = url_constant_1.DEBUG_URL; } return host; }; ServiceLocator.prototype.getExternalPersonUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.PUBLIC_PERSON_ENDPOINT); }; ServiceLocator.prototype.getDependencyUrlLegacy = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.DEPENDENCY_ENDPOINT); }; ServiceLocator.prototype.getCountryUrlLegacy = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.API, url_constant_1.COUNTRY_ENDPOINT); }; ServiceLocator.prototype.getDependencyUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.DEPENDENCY_ENDPOINT, url_constant_1.GET_DEPENDENCIES); }; ServiceLocator.prototype.getProgramUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.API, url_constant_1.PROGRAM_ENDPOINT); }; ServiceLocator.prototype.getFacultyUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.PUBLIC_FACULTY_ENDPOINT); }; ServiceLocator.prototype.getStudentUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.PUBLIC_STUDENT_ENDPOINT); }; ServiceLocator.prototype.getUniversityUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.UNIVERSITY_ENDPOINT); }; ServiceLocator.prototype.getUsersUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.USERS_API, url_constant_1.SERVICES, url_constant_1.PRIVATE_USERS_ENDPOINT); }; ServiceLocator.prototype.buildURL = function () { var urlElements = []; for (var _i = 0; _i < arguments.length; _i++) { urlElements[_i] = arguments[_i]; } return urlElements.reduce(function (accumulator, currentValue) { return accumulator + '/' + currentValue; }); }; ServiceLocator.decorators = [ { type: core_1.Injectable }, ]; return ServiceLocator; }()); exports.ServiceLocator = ServiceLocator; //# sourceMappingURL=service-locator.js.map