commit 59e4aabd52ca10b6ead2a84379a16b538acaceb0 parent 386da9ddfdc19b7faa64d8b9dd70b3dd1ad1f513 Author: MTRNord <mtrnord1@gmail.com> Date: Sat, 17 Feb 2018 13:57:36 +0100 Typings Diffstat:
| M | src/app/api.service.ts | | | 19 | ++++++++++++++++++- |
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/app/api.service.ts b/src/app/api.service.ts @@ -2,6 +2,23 @@ import {Inject, Injectable} from '@angular/core'; import { HttpClient } from '@angular/common/http'; import {DOCUMENT} from '@angular/common'; +export interface Tweet { + tweets?: (TweetsEntity)[] | null; +} +export interface TweetsEntity { + username: string; + user_id: string; + display_name: string; + userprofile_link: string; + text: string; + image_urls?: (string)[] | null; + created_at: string; + favorites: string; + retweets: string; + retweet: boolean; +} + + @Injectable() export class ApiService { private url; @@ -11,6 +28,6 @@ export class ApiService { // Uses http.get() to load data from a single API endpoint getYesterday(uuid: string) { - return this.http.get(`${this.url}/paper/${uuid}/yesterday`); + return this.http.get<Tweet>(`${this.url}/paper/${uuid}/yesterday`); } }