1 | <?php |
||
19 | class ApiResponse |
||
20 | { |
||
21 | /** |
||
22 | * @var \stdClass |
||
23 | */ |
||
24 | protected $result; |
||
25 | |||
26 | /** |
||
27 | * @var \stdClass |
||
28 | */ |
||
29 | private $meta; |
||
30 | 71 | ||
31 | /** |
||
32 | 71 | * @param \stdClass $response |
|
33 | 1 | */ |
|
34 | public function __construct(\stdClass $response) |
||
43 | |||
44 | /** |
||
45 | 16 | * Returns the result of the response |
|
46 | * |
||
47 | 16 | * @return \stdClass |
|
48 | */ |
||
49 | public function getResult() |
||
53 | |||
54 | /** |
||
55 | 2 | * Returns the HTTP code |
|
56 | * |
||
57 | 2 | * @return integer |
|
58 | */ |
||
59 | public function getStatusCode() |
||
63 | |||
64 | /** |
||
65 | 1 | * Returns true is the response is successful |
|
66 | * |
||
67 | 1 | * @return Boolean |
|
68 | */ |
||
69 | public function isOk() |
||
73 | |||
74 | /** |
||
75 | 4 | * Returns true if the response content is empty |
|
76 | * |
||
77 | 4 | * @return Boolean |
|
78 | */ |
||
79 | public function isEmpty() |
||
83 | |||
84 | /** |
||
85 | 1 | * Returns the error message |
|
86 | * |
||
87 | 1 | * @return string|null |
|
88 | */ |
||
89 | public function getErrorMessage() |
||
93 | |||
94 | /** |
||
95 | 1 | * Returns error details |
|
96 | * |
||
97 | 1 | * @return string|null |
|
98 | */ |
||
99 | public function getErrorDetails() |
||
103 | |||
104 | /** |
||
105 | 1 | * Returns the response datetime |
|
106 | * |
||
107 | 1 | * @return \DateTime |
|
108 | */ |
||
109 | public function getResponseTime() |
||
113 | |||
114 | /** |
||
115 | 1 | * Returns the requested URI |
|
116 | * |
||
117 | 1 | * @return string |
|
118 | */ |
||
119 | 1 | public function getUri() |
|
125 | |||
126 | /** |
||
127 | 1 | * Returns the requested method |
|
128 | * |
||
129 | 1 | * @return string |
|
130 | */ |
||
131 | 1 | public function getMethod() |
|
137 | |||
138 | /** |
||
139 | 1 | * Returns the response charset |
|
140 | * |
||
141 | 1 | * @return string |
|
142 | */ |
||
143 | public function getCharset() |
||
147 | |||
148 | /** |
||
149 | 1 | * Returns the API version |
|
150 | * |
||
151 | 1 | * @return string |
|
152 | */ |
||
153 | public function getApiVersion() |
||
157 | |||
158 | /** |
||
159 | * Returns true if the response has the given property |
||
160 | * |
||
161 | 49 | * @param string $property The property name |
|
162 | * |
||
163 | 49 | * @return Boolean |
|
164 | */ |
||
165 | public function hasProperty($property) |
||
169 | |||
170 | /** |
||
171 | * Returns the response property, null if the property does not exist |
||
172 | * |
||
173 | 28 | * @param string $property The property name |
|
174 | * |
||
175 | 28 | * @return \stdClass|\stdClass[]|null |
|
176 | */ |
||
177 | public function getProperty($property) |
||
181 | } |
||
182 |