44 lines
1.4 KiB
TypeScript
44 lines
1.4 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';
|
|
|
|
|
|
@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) {
|
|
return this.http.get("registries" + "?query=" + like);
|
|
}
|
|
|
|
public searchDatasetRepository(like: string) {
|
|
return this.http.get("datarepos" + "?query=" + like);
|
|
}
|
|
|
|
public searchDatasetService(like: string) {
|
|
return this.http.get("services" + "?query=" + like);
|
|
}
|
|
|
|
public searchDMPResearchers(like: string) {
|
|
return this.http.get("researchers" + "?query=" + like);
|
|
}
|
|
|
|
public searchDMPOrganizations(like: string): Observable<any> {
|
|
return this.http.get<any>(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers });
|
|
}
|
|
}
|