argos/dmp-frontend/src/app/services/external-sources/external-sources.service.ts

49 lines
2.2 KiB
TypeScript
Raw Normal View History

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
}
2017-12-20 17:50:16 +01:00
public searchDMPProfiles(like: string): Observable<ExternalSourcesItemModel[]> {
2017-12-20 17:54:48 +01:00
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers });
2017-12-20 17:50:16 +01:00
}
2017-12-18 11:01:22 +01:00
}