57 lines
2.8 KiB
TypeScript
57 lines
2.8 KiB
TypeScript
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<ExternalSourcesItemModel[]> {
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "registries" + "?query=" + like, { headers: this.headers });
|
|
}
|
|
|
|
public searchDatasetRepository(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datarepos" + "?query=" + like, { headers: this.headers });
|
|
}
|
|
|
|
public searchDatasetService(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "services" + "?query=" + like, { headers: this.headers });
|
|
}
|
|
|
|
public searchDatasetSExternalDatasetservice(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasets" + "?query=" + like, { headers: this.headers });
|
|
}
|
|
|
|
public searchDMPResearchers(requestItem: RequestItem<ResearcherCriteria>): Observable<ExternalSourcesItemModel[]> {
|
|
return this.http.post<ExternalSourcesItemModel[]>(HostConfiguration.Server + "/researchers/getWithExternal", requestItem, { headers: this.headers });
|
|
}
|
|
|
|
public searchDMPOrganizations(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers });
|
|
}//organizationscriteria.criteria.like
|
|
|
|
public searchDMPProfiles(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers });
|
|
}
|
|
|
|
}
|