2017-12-18 11:01:22 +01:00
|
|
|
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';
|
2017-12-18 12:24:12 +01:00
|
|
|
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
|
2017-12-18 11:01:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
@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');
|
|
|
|
}
|
|
|
|
|
2017-12-18 12:24:12 +01:00
|
|
|
public searchDatasetRegistry(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "registries" + "?query=" + like, { headers: this.headers });
|
2017-12-18 11:01:22 +01:00
|
|
|
}
|
|
|
|
|
2017-12-18 12:24:12 +01:00
|
|
|
public searchDatasetRepository(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datarepos" + "?query=" + like, { headers: this.headers });
|
2017-12-18 11:01:22 +01:00
|
|
|
}
|
|
|
|
|
2017-12-18 12:24:12 +01:00
|
|
|
public searchDatasetService(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "services" + "?query=" + like, { headers: this.headers });
|
2017-12-18 11:01:22 +01:00
|
|
|
}
|
|
|
|
|
2017-12-18 12:24:12 +01:00
|
|
|
public searchDMPResearchers(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "researchers" + "?query=" + like, { headers: this.headers });
|
2017-12-18 11:01:22 +01:00
|
|
|
}
|
|
|
|
|
2017-12-18 12:24:12 +01:00
|
|
|
public searchDMPOrganizations(like: string): Observable<ExternalSourcesItemModel[]> {
|
|
|
|
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers });
|
2017-12-18 11:01:22 +01:00
|
|
|
}
|
|
|
|
}
|