1 | <?php |
||
19 | class Client implements ClientInterface |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Request parameters |
||
24 | * |
||
25 | * @var \Symfony\Component\HttpFoundation\ParameterBag |
||
26 | */ |
||
27 | protected $parameters; |
||
28 | |||
29 | /** |
||
30 | * HTTP Client |
||
31 | * @var \GuzzleHttp\ClientInterface |
||
32 | */ |
||
33 | protected $httpClient; |
||
34 | |||
35 | /** |
||
36 | * Instantiate Visual Recognition client with API credentials |
||
37 | * |
||
38 | * @api |
||
39 | * @param HttpClientInterface|null $httpClient |
||
40 | * @throws \Exception |
||
41 | */ |
||
42 | public function __construct(HttpClientInterface $httpClient = null) |
||
46 | |||
47 | /** |
||
48 | * Get the global default HTTP client. |
||
49 | * |
||
50 | * @return HttpClient |
||
51 | */ |
||
52 | protected function getDefaultHttpClient() |
||
60 | |||
61 | /** |
||
62 | * Initialize this client with default parameters |
||
63 | * |
||
64 | * @param array $parameters |
||
65 | * @return $this |
||
66 | */ |
||
67 | public function initialize(array $parameters = array()) |
||
80 | |||
81 | /** |
||
82 | * Create new request object and initialize. |
||
83 | * |
||
84 | * @param $class |
||
85 | * @param array $parameters |
||
86 | * @return mixed |
||
87 | */ |
||
88 | protected function createRequest($class, array $parameters) |
||
95 | |||
96 | /** |
||
97 | * Default & required parameters for requests |
||
98 | * |
||
99 | */ |
||
100 | public function getDefaultParameters() |
||
108 | |||
109 | /** |
||
110 | * Get Parameters |
||
111 | * |
||
112 | * @return array |
||
113 | */ |
||
114 | public function getParameters() |
||
118 | |||
119 | /** |
||
120 | * Get Username |
||
121 | * |
||
122 | * @return mixed |
||
123 | */ |
||
124 | public function getUsername() |
||
128 | |||
129 | /** |
||
130 | * Set Username |
||
131 | * |
||
132 | * @param $value |
||
133 | * @return $this |
||
134 | */ |
||
135 | public function setUsername($value) |
||
141 | |||
142 | /** |
||
143 | * Get password |
||
144 | * |
||
145 | * @return mixed |
||
146 | */ |
||
147 | public function getPassword() |
||
151 | |||
152 | /** |
||
153 | * Set Password |
||
154 | * |
||
155 | * @param $value |
||
156 | * @return $this |
||
157 | */ |
||
158 | public function setPassword($value) |
||
164 | |||
165 | /** |
||
166 | * Get Version |
||
167 | * |
||
168 | * @return mixed |
||
169 | */ |
||
170 | public function getVersion() |
||
174 | |||
175 | /** |
||
176 | * Set version |
||
177 | * |
||
178 | * @param $value |
||
179 | * @return $this |
||
180 | */ |
||
181 | public function setVersion($value) |
||
187 | |||
188 | /** |
||
189 | * Get list of available classifiers |
||
190 | * |
||
191 | * @api |
||
192 | * @param array $parameters |
||
193 | * @return GetClassifiersRequest |
||
194 | * @throws \Exception |
||
195 | */ |
||
196 | public function getClassifiers(array $parameters = []) |
||
200 | |||
201 | /** |
||
202 | * Classify image |
||
203 | * |
||
204 | * @param array $parameters |
||
205 | * @return ClassifyRequest |
||
206 | */ |
||
207 | public function classify(array $parameters = []) |
||
211 | } |
||
212 |