import 'rxjs/add/operator/map'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { HostConfiguration } from './../../app.constants'; import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service'; import { Observable } from 'rxjs/Observable'; import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel'; import { BaseCriteria } from '../../models/criteria/BaseCriteria'; import { RequestItem } from '../../models/criteria/RequestItem'; import { ResearcherCriteria } from '../../models/criteria/researchers/ResearcherCriteria'; @Injectable() export class ExternalSourcesService { private actionUrl: string; private headers: HttpHeaders; constructor(private http: BaseHttpService) { this.actionUrl = HostConfiguration.Server + 'external/'; this.headers = new HttpHeaders(); this.headers = this.headers.set('Content-Type', 'application/json'); this.headers = this.headers.set('Accept', 'application/json'); } public searchDatasetRegistry(like: string): Observable { return this.http.get(this.actionUrl + "registries" + "?query=" + like, { headers: this.headers }); } public searchDatasetRepository(like: string): Observable { return this.http.get(this.actionUrl + "datarepos" + "?query=" + like, { headers: this.headers }); } public searchDatasetService(like: string): Observable { return this.http.get(this.actionUrl + "services" + "?query=" + like, { headers: this.headers }); } public searchDatasetSExternalDatasetservice(like: string): Observable { return this.http.get(this.actionUrl + "datasets" + "?query=" + like, { headers: this.headers }); } public searchDMPResearchers(requestItem: RequestItem): Observable { return this.http.post(HostConfiguration.Server + "/researchers/getWithExternal", requestItem, { headers: this.headers }); } public searchDMPOrganizations(like: string): Observable { return this.http.get(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers }); }//organizationscriteria.criteria.like public searchDMPProfiles(like: string): Observable { return this.http.get(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers }); } }