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

57 lines
2.8 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';
2018-05-14 08:44:35 +02:00
import { BaseCriteria } from '../../models/criteria/BaseCriteria';
import { RequestItem } from '../../models/criteria/RequestItem';
import { ResearcherCriteria } from '../../models/criteria/researchers/ResearcherCriteria';
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
}
2018-01-17 12:57:41 +01:00
public searchDatasetSExternalDatasetservice(like: string): Observable<ExternalSourcesItemModel[]> {
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "datasets" + "?query=" + like, { headers: this.headers });
}
2018-03-08 11:54:56 +01:00
public searchDMPResearchers(requestItem: RequestItem<ResearcherCriteria>): Observable<ExternalSourcesItemModel[]> {
return this.http.post<ExternalSourcesItemModel[]>(HostConfiguration.Server + "/researchers/getWithExternal", requestItem, { headers: this.headers });
2017-12-18 11:01:22 +01:00
}
2018-02-23 13:12:58 +01:00
public searchDMPOrganizations(like: string): Observable<ExternalSourcesItemModel[]> {
return this.http.get<ExternalSourcesItemModel[]>(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers });
}//organizationscriteria.criteria.like
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
}
2018-01-17 16:06:35 +01:00
2017-12-18 11:01:22 +01:00
}