openaire-library/connect/contentProviders/searchDataproviders.service.ts

20 lines
884 B
TypeScript

import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {EnvProperties} from '../../utils/properties/env-properties';
import {map} from "rxjs/operators";
@Injectable()
export class SearchCommunityDataprovidersService {
constructor(private http: HttpClient ) {}
searchDataproviders (properties:EnvProperties, communityId: string):any {
let url = properties.communityAPI+communityId+"/contentproviders";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
}
countTotalDataproviders(properties:EnvProperties,communityId:string) {
let url = properties.communityAPI+communityId+"/contentproviders";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['length']));
}
}