UNPKG

ngx-academia-uniandes-library

Version:

This library is used for Academia-Uniandes system.

107 lines 6.43 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.getHostBirt = function (isDebug) { var host = window.location.origin; console.log("Host:", host); if (host.includes('https://academia.uniandes.edu.co')) { host = url_constant_1.PROD_BIRT_URL; } if (host.includes('https://academiapr2.uniandes.edu.co')) { host = url_constant_1.QA_BIRT_URL; } 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.getCityUrlLegacy = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.CITY_ENDPOINT); }; ServiceLocator.prototype.getDependencyUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.PUBLIC_DEPENDENCY_ENDPOINT); }; ServiceLocator.prototype.getCorefacilityUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.API, url_constant_1.CORE_FACILITY_ENDPOINT); }; ServiceLocator.prototype.getCategoryImpactsUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.API, url_constant_1.CATEGORIES_IMPACTS_ENDPOINT); }; ServiceLocator.prototype.getSubCategoriesImpactsUrl = function (cateroryId, isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.API, url_constant_1.SUBCATEGORIES_CATEGORY_IMPACTS_ENDPOINT, cateroryId); }; 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.getProductUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.API_WEBSERVICES_LEGACY, url_constant_1.PRODUCT_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.getPhdStudentUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.PHD_API, url_constant_1.SERVICES, url_constant_1.PHD_PUBLIC_API, url_constant_1.SEARCH_PHDSTUDENT_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.getBirtUrl = function (isDebug) { return this.buildURL(this.getHostBirt(isDebug), url_constant_1.BIRT_URL); }; ServiceLocator.prototype.getFormatProductsUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.PRODUCTS_API, url_constant_1.SERVICES, url_constant_1.FORMATS_PUBLIC_API, url_constant_1.FORMATSPRODUCT_ENDPOINT); }; ServiceLocator.prototype.getFormatGroupsProductsUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.PRODUCTS_API, url_constant_1.SERVICES, url_constant_1.FORMATS_PUBLIC_API, url_constant_1.FORMATSGROUPSPRODUCT_ENDPOINT); }; ServiceLocator.prototype.getResearchGroupsUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.PUBLIC_RESEARCHGROUP_ENDPOINT, url_constant_1.GET_RESEARCH_GROUP_ENDPOINT); }; ServiceLocator.prototype.getResearchLinesUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.CORE_API, url_constant_1.SERVICES, url_constant_1.PUBLIC_RESEARCHGROUP_ENDPOINT, url_constant_1.GET_RESEARCH_LINE_ENDPOINT); }; ServiceLocator.prototype.getResourcesFundingUrl = function (isDebug) { return this.buildURL(this.getHost(isDebug), url_constant_1.PHD_API, url_constant_1.SERVICES, url_constant_1.PHD_PUBLIC_API, url_constant_1.SEARCH_RESOURCES_FUNDING); }; 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