openaire-library/landingPages/htmlProjectReport/htmlProjectReport.service.ts

35 lines
1.1 KiB
TypeScript

import {Injectable} from '@angular/core';
import {HttpClient} from "@angular/common/http";
@Injectable()
export class HtmlProjectReportService {
constructor(private http: HttpClient ) {}
getHTML(id: string, size: number, type:string, csvAPIURL: string ):any {
let resultTypeId: string;
let requestType: string;
if(type == "publication") {
resultTypeId = 'publication';
requestType = 'publications';
} else if(type == "research data") {
resultTypeId = 'dataset';
requestType = 'datasets';
} else if(type == "software") {
resultTypeId = 'software';
requestType = 'software'
} else if(type == 'other research products') {
resultTypeId = 'other';
requestType = 'other';
}
let url = csvAPIURL;
url += '?format=html&type='+requestType+'&fq=(((oaftype exact result) and (resulttypeid exact "'+resultTypeId+'")) and (relprojectid exact "'+id+'"))';
let key = url;
return this.http.get(url,{responseType: 'text'});
}
}