2018-03-29 16:15:47 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {HttpClient} from "@angular/common/http";
|
2019-06-05 15:33:18 +02:00
|
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
|
|
|
import {map} from "rxjs/operators";
|
2018-03-29 16:15:47 +02:00
|
|
|
|
|
|
|
@Injectable()
|
2018-04-04 14:35:31 +02:00
|
|
|
export class SearchCommunityDataprovidersService {
|
2019-06-03 15:20:36 +02:00
|
|
|
constructor(private http: HttpClient ) {}
|
2024-02-28 13:46:29 +01:00
|
|
|
searchDataproviders (properties:EnvProperties, pid: string, deposit = false):any {
|
|
|
|
let url = properties.communityAPI+pid+"/datasources" + (deposit?'?deposit=true':'');
|
2018-03-29 16:15:47 +02:00
|
|
|
|
2019-06-03 15:20:36 +02:00
|
|
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
2019-06-05 15:33:18 +02:00
|
|
|
}
|
2020-04-08 13:25:41 +02:00
|
|
|
countTotalDataproviders(properties:EnvProperties,pid:string) {
|
2024-02-28 13:46:29 +01:00
|
|
|
let url = properties.communityAPI+pid+"/datasources";
|
2019-06-05 15:33:18 +02:00
|
|
|
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
|
|
|
.pipe(map(res => res['length']));
|
2018-03-29 16:15:47 +02:00
|
|
|
}
|
|
|
|
}
|