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

20 lines
852 B
TypeScript
Raw Permalink Normal View History

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, pid: string):any {
let url = properties.communityAPI+pid+"/contentproviders";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
}
countTotalDataproviders(properties:EnvProperties,pid:string) {
let url = properties.communityAPI+pid+"/contentproviders";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['length']));
}
}