3 changed files with 39 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||
|
|||
export class Balance { |
|||
address: string; |
|||
available: number; |
|||
received: number; |
|||
spent: number; |
|||
} |
@ -0,0 +1,7 @@ |
|||
|
|||
export class PaginatedResult<T> { |
|||
offset: number; |
|||
limit: number; |
|||
total: number; |
|||
data: T[]; |
|||
} |
@ -0,0 +1,25 @@ |
|||
import { Injectable } from '@angular/core'; |
|||
import { HttpClient, HttpHeaders } from '@angular/common/http'; |
|||
import { Observable } from 'rxjs/Observable'; |
|||
|
|||
import { environment } from '../../environments/environment'; |
|||
|
|||
import { Balance } from '../models/balance'; |
|||
import { PaginatedResult } from '../models/paginated-result'; |
|||
|
|||
const httpOptions = { |
|||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }) |
|||
}; |
|||
|
|||
@Injectable() |
|||
export class BalancesService { |
|||
|
|||
private baseUrl = environment.api.url + '/balances'; |
|||
|
|||
constructor(private http: HttpClient) { } |
|||
|
|||
getRichest(offset: number = 0, limit: number = 10): Observable<PaginatedResult<Balance>> { |
|||
const url = `${this.baseUrl}?offset=${offset}&limit=${limit}`; |
|||
return this.http.get<PaginatedResult<Balance>>(url); |
|||
} |
|||
} |
Loading…
Reference in new issue