| @@ 125-134 (lines=10) @@ | ||
| 122 | * |
|
| 123 | * @return array|\JMS\Serializer\scalar|object |
|
| 124 | */ |
|
| 125 | public function userShow($customer_id) |
|
| 126 | { |
|
| 127 | $response = $this->getGuzzleClient() |
|
| 128 | ->get('/users/' . $customer_id, $this->setQuery()); |
|
| 129 | ||
| 130 | return $this->serializer->deserialize( |
|
| 131 | $response->getBody()->getContents(), |
|
| 132 | User::class, |
|
| 133 | 'json' |
|
| 134 | ); |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| @@ 174-186 (lines=13) @@ | ||
| 171 | * |
|
| 172 | * @return array|\JMS\Serializer\scalar|object |
|
| 173 | */ |
|
| 174 | public function categoryPredict($site_id, $title) |
|
| 175 | { |
|
| 176 | $response = $this->getGuzzleClient() |
|
| 177 | ->get( |
|
| 178 | '/sites/' . $site_id . '/category_predictor/predict', |
|
| 179 | $this->setQuery(['title' => $title]) |
|
| 180 | ); |
|
| 181 | return $this->serializer->deserialize( |
|
| 182 | $response->getBody()->getContents(), |
|
| 183 | CategoryPrediction::class, |
|
| 184 | 'json' |
|
| 185 | ); |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * Item List resource |
|
| @@ 195-205 (lines=11) @@ | ||
| 192 | * |
|
| 193 | * @return array|\JMS\Serializer\scalar|object |
|
| 194 | */ |
|
| 195 | public function itemList($user_id) |
|
| 196 | { |
|
| 197 | $response = $this->getGuzzleClient() |
|
| 198 | ->get('/users/' . $user_id . '/items/search', $this->setQuery()); |
|
| 199 | ||
| 200 | return $this->serializer->deserialize( |
|
| 201 | $response->getBody()->getContents(), |
|
| 202 | ItemList::class, |
|
| 203 | 'json' |
|
| 204 | ); |
|
| 205 | } |
|
| 206 | ||
| 207 | /** |
|
| 208 | * Item Show resource |
|
| @@ 214-224 (lines=11) @@ | ||
| 211 | * |
|
| 212 | * @return array|\JMS\Serializer\scalar|object |
|
| 213 | */ |
|
| 214 | public function itemShow($item_id) |
|
| 215 | { |
|
| 216 | $response = $this->getGuzzleClient() |
|
| 217 | ->get('/items/' . $item_id, $this->setQuery()); |
|
| 218 | ||
| 219 | return $this->serializer->deserialize( |
|
| 220 | $response->getBody()->getContents(), |
|
| 221 | Item::class, |
|
| 222 | 'json' |
|
| 223 | ); |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * Item create resource |
|
| @@ 233-246 (lines=14) @@ | ||
| 230 | * |
|
| 231 | * @return array|\JMS\Serializer\scalar|object |
|
| 232 | */ |
|
| 233 | public function itemCreate(Item $item) |
|
| 234 | { |
|
| 235 | $response = $this->getGuzzleClient() |
|
| 236 | ->post( |
|
| 237 | '/items', |
|
| 238 | array_merge($this->setQuery(), $this->setBody($item)) |
|
| 239 | ); |
|
| 240 | ||
| 241 | return $this->serializer->deserialize( |
|
| 242 | $response->getBody()->getContents(), |
|
| 243 | Item::class, |
|
| 244 | 'json' |
|
| 245 | ); |
|
| 246 | } |
|
| 247 | ||
| 248 | /** |
|
| 249 | * Set query |
|