Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Add historic range query service
Browse files Browse the repository at this point in the history
To discover the available historic ranges.
  • Loading branch information
flibbertigibbet committed Sep 2, 2017
1 parent 18b28b9 commit 3cc4367
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/models/historic-range.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface HistoricRange {
start_year: string;
end_year: string;
}
21 changes: 21 additions & 0 deletions src/app/services/historic-range.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';

import { HistoricRange } from '../models/historic-range.model';
import { ApiHttp } from '../auth/api-http.service';
import { apiHost } from '../constants';

/*
* Historic Range Service
* Returns available historic ranges from API
*/
@Injectable()
export class HistoricRangeService {

constructor(private apiHttp: ApiHttp) {}

public list(): Observable<Scenario[]> {
const url = apiHost + '/api/historic-range/';
return this.apiHttp.get(url).map(resp => resp.json() || [] as HistoricRange[]);
}
}

0 comments on commit 3cc4367

Please sign in to comment.