import { Injectable } from "@angular/core"; import { of as observableOf, Observable, throwError } from "rxjs"; import { HttpClient, HttpHeaders } from "@angular/common/http"; import { retry, catchError, map, timeout } from "rxjs/operators"; import { environment } from "@environments/environment"; @Injectable({ providedIn: "root" }) export class CatalogsService { time: number = 6000; constructor(private http: HttpClient) {} getCatalogInfo(url: string) { return this.http .get(`${environment.productionApiUrl}/${url}`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // paises getCountries() { return this.http .get(`${environment.productionApiUrl}/paises`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // empresas getCompanies() { return this.http .get(`${environment.productionApiUrl}/empresas`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // entidades-financieras getFinancialEntities() { return this.http .get(`${environment.productionApiUrl}/entidades-financieras`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // origenes-fondos getFundsOrigins() { return this.http .get(`${environment.productionApiUrl}/origenes-fondos`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // periodicidades getPeriodicities() { return this.http .get(`${environment.productionApiUrl}/periodicidades`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // plazos getPaymentTerms() { return this.http .get(`${environment.productionApiUrl}/plazos`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-bases getBaseTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-bases`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-emisores getEmitterTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-emisores`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-entidades getEntityTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-entidades`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-instrumentos getInstrumentTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-instrumentos`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-mercados getMarketTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-mercados`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-operaciones getOperationTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-operaciones`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-pagos getPaymentTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-pagos`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-rentas getRevenueTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-rentas`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // tipos-tasas getRateTypes() { return this.http .get(`${environment.productionApiUrl}/tipos-tasas`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // calificadoras getRateAgencies() { return this.http .get(`${environment.productionApiUrl}/calificadoras`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // calificaciones getScores() { return this.http .get(`${environment.productionApiUrl}/calificaciones`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } // formato ingreso getIncomeFormat() { return this.http .get(`${environment.productionApiUrl}/formato-ingresos`, {}) .pipe( map(response => { return response; }), catchError(this.errorHandl) ); } /** * * api/calificacion/ ^ api/calificaciones ^ api/calificadora/ ^ api/calificadoras ^ api/empresa/ ^ api/empresas ^ api/entidad-financiera/ ^ api/entidades-financieras ^ api/estado-inversion/ ^ api/estados-inversiones * * * */ //if(error.error instanceof ErrorEvent) { errorHandl(error) { let errorMessage = ""; if (error.error) { // Get client-side error errorMessage = error.error; } else { // Get server-side error errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; } return throwError(errorMessage); } }