blob: 5859634d6defdddc105bee27124880ce3836ac96 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Configuration } from './configuration.service';
import Predictor from '../_data/Predictor';
import { AuthService } from './auth.service';
@Injectable({
providedIn: 'root'
})
export class PredictorsService {
constructor(private http: HttpClient, private authService: AuthService) { }
getPublicPredictors(): Observable<Predictor[]> {
return this.http.get<Predictor[]>(`${Configuration.settings.apiURL}/predictor/publicpredictors`, { headers: this.authService.authHeader() });
}
getPredictor(id: String): Observable<Predictor> {
return this.http.get<Predictor>(`${Configuration.settings.apiURL}/predictor/getpredictor/` + id, { headers: this.authService.authHeader() });
}
usePredictor(predictor: Predictor, inputs: Column[]) {
return this.http.post(`${Configuration.settings.apiURL}/predictor/usepredictor/` + predictor._id, inputs, { headers: this.authService.authHeader() });
}
deletePredictor(predictor: Predictor) {
return this.http.delete(`${Configuration.settings.apiURL}/predictor/` + predictor._id, { headers: this.authService.authHeader(), responseType: "text" });
}
getMyPredictors(): Observable<Predictor[]> {
return this.http.get<Predictor[]>(`${Configuration.settings.apiURL}/predictor/mypredictors`, { headers: this.authService.authHeader() });
}
downloadH5(id: string): Observable<Blob> {
return this.http.get(`${Configuration.settings.apiURL}/file/Download?id=` + id, { headers: this.authService.authHeader(), responseType: 'blob' });
}
}
export class Column {
constructor(
public name: string,
public value: (number | string)) {
}
}
|