@@ 34-48 (lines=15) @@ | ||
31 | * |
|
32 | * @throws Exception |
|
33 | */ |
|
34 | public function index(array $params = []) |
|
35 | { |
|
36 | $response = $this->httpGet('/v1/tweets', $params); |
|
37 | ||
38 | if (!$this->hydrator) { |
|
39 | return $response; |
|
40 | } |
|
41 | ||
42 | // Use any valid status code here |
|
43 | if ($response->getStatusCode() !== 200) { |
|
44 | $this->handleErrors($response); |
|
45 | } |
|
46 | ||
47 | return $this->hydrator->hydrate($response, Tweets::class); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @param int $id |
@@ 58-72 (lines=15) @@ | ||
55 | * |
|
56 | * @throws Exception |
|
57 | */ |
|
58 | public function total(array $params = []) |
|
59 | { |
|
60 | $response = $this->httpGet('/v1/stats', $params); |
|
61 | ||
62 | if (!$this->hydrator) { |
|
63 | return $response; |
|
64 | } |
|
65 | ||
66 | // Use any valid status code here |
|
67 | if ($response->getStatusCode() !== 200) { |
|
68 | $this->handleErrors($response); |
|
69 | } |
|
70 | ||
71 | return $this->hydrator->hydrate($response, Total::class); |
|
72 | } |
|
73 | } |
|
74 |