1 | <?php |
||
2 | |||
3 | namespace Uon\Endpoints; |
||
4 | |||
5 | use Uon\Client; |
||
6 | |||
7 | /** |
||
8 | * Class Requests |
||
9 | * |
||
10 | * @package Uon\Endpoint |
||
11 | */ |
||
12 | class Requests extends Client |
||
13 | { |
||
14 | /** |
||
15 | * Create new request |
||
16 | * |
||
17 | * @link https://api.u-on.ru/{key}/request/create.{_format} |
||
18 | * |
||
19 | * @param array $parameters List of parameters |
||
20 | * |
||
21 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
22 | */ |
||
23 | public function create(array $parameters) |
||
24 | { |
||
25 | // Set HTTP params |
||
26 | $this->type = 'post'; |
||
27 | $this->endpoint = 'request/create'; |
||
28 | $this->params = $parameters; |
||
29 | |||
30 | return $this->done(); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Adding touch to the request |
||
35 | * |
||
36 | * @link https://api.u-on.ru/{key}/request-action/create.{_format} |
||
37 | * |
||
38 | * @param array $parameters List of parameters |
||
39 | * |
||
40 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
41 | */ |
||
42 | public function createActions(array $parameters) |
||
43 | { |
||
44 | // Set HTTP params |
||
45 | $this->type = 'post'; |
||
46 | $this->endpoint = 'request-action/create'; |
||
47 | $this->params = $parameters; |
||
48 | |||
49 | return $this->done(); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Add file into request |
||
54 | * |
||
55 | * @link https://api.u-on.ru/{key}/request-file/create.{_format} |
||
56 | * |
||
57 | * @param array $parameters List of parameters |
||
58 | * |
||
59 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
60 | */ |
||
61 | public function createFile(array $parameters) |
||
62 | { |
||
63 | // Set HTTP params |
||
64 | $this->type = 'post'; |
||
65 | $this->endpoint = 'request-file/create'; |
||
66 | $this->params = $parameters; |
||
67 | |||
68 | return $this->done(); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Add tourist in request |
||
73 | * |
||
74 | * @link https://api.u-on.ru/{key}/tourists-requests/create.{_format} |
||
75 | * |
||
76 | * @param array $parameters List of parameters [r_id, tourist_id] |
||
77 | * |
||
78 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
79 | */ |
||
80 | public function createTourist(array $parameters) |
||
81 | { |
||
82 | // Set HTTP params |
||
83 | $this->type = 'post'; |
||
84 | $this->endpoint = 'tourists-requests/create'; |
||
85 | $this->params = $parameters; |
||
86 | |||
87 | return $this->done(); |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * Get requests data by filter |
||
92 | * |
||
93 | * @link https://api.u-on.ru/{key}/request/search.{_format} |
||
94 | * |
||
95 | * @param array $parameters List of parameters |
||
96 | * |
||
97 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
98 | */ |
||
99 | public function search(array $parameters = []) |
||
100 | { |
||
101 | // Set HTTP params |
||
102 | $this->type = 'post'; |
||
103 | $this->endpoint = 'request/search'; |
||
104 | $this->params = $parameters; |
||
105 | |||
106 | return $this->done(); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * Get request by ID |
||
111 | * |
||
112 | * @link https://api.u-on.ru/{key}/request/{id}.{_format} |
||
113 | * |
||
114 | * @param int $id Request unique ID |
||
115 | * @param array $parameters List of parameters |
||
116 | * |
||
117 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
118 | */ |
||
119 | public function get(int $id, array $parameters = []) |
||
120 | { |
||
121 | // Set HTTP params |
||
122 | $this->type = 'get'; |
||
123 | $this->endpoint = 'request/' . $id; |
||
124 | $this->params = $parameters; |
||
125 | |||
126 | return $this->done(); |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * Get touch of the request by ID |
||
131 | * |
||
132 | * @link https://api.u-on.ru/{key}/request-action/create.{_format} |
||
133 | * |
||
134 | * @param int $id List of parameters |
||
135 | * |
||
136 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
137 | */ |
||
138 | public function getActions(int $id) |
||
139 | { |
||
140 | // Set HTTP params |
||
141 | $this->type = 'get'; |
||
142 | $this->endpoint = 'request-action/' . $id; |
||
143 | |||
144 | return $this->done(); |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * Get requests data by client ID |
||
149 | * |
||
150 | * @link https://api.u-on.ru/{key}/request-by-client/create.{_format} |
||
151 | * |
||
152 | * @param int $id List of parameters |
||
153 | * @param int $page Number of page, 1 by default |
||
154 | * |
||
155 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
156 | */ |
||
157 | public function getByClient(int $id, int $page = 1) |
||
158 | { |
||
159 | // Set HTTP params |
||
160 | $this->type = 'get'; |
||
161 | $this->endpoint = 'request-by-client/' . $id . '/' . $page; |
||
162 | |||
163 | return $this->done(); |
||
164 | } |
||
165 | |||
166 | /** |
||
167 | * Get requests by dates range (and by source ID) |
||
168 | * |
||
169 | * @link https://api.u-on.ru/{key}/request/{date_from}/{date_to}.{_format} |
||
170 | * @link https://api.u-on.ru/{key}/request/{date_from}/{date_to}/{source_id}.{_format} |
||
171 | * |
||
172 | * @param string $dateFrom Start of dates range |
||
173 | * @param string $dateTo End of dates range |
||
174 | * @param int $page Number of page, 1 by default |
||
175 | * @param int|null $sourceId Source ID, eg ID of SMS or JivoSite |
||
176 | * |
||
177 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
178 | */ |
||
179 | public function getDate(string $dateFrom, string $dateTo, int $page = 1, int $sourceId = null) |
||
180 | { |
||
181 | $endpoint = 'requests/' . $dateFrom . '/' . $dateTo; |
||
182 | if (null !== $sourceId) { |
||
183 | $endpoint .= '/' . $sourceId; |
||
184 | } |
||
185 | $endpoint .= '/' . $page; |
||
186 | |||
187 | // Set HTTP params |
||
188 | $this->type = 'get'; |
||
189 | $this->endpoint = $endpoint; |
||
190 | |||
191 | return $this->done(); |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * Get touch of the requests in dates range |
||
196 | * |
||
197 | * @link https://api.u-on.ru/{key}/request/{date_from}/{date_to}.{_format} |
||
198 | * |
||
199 | * @param string $dateFrom Start of dates range |
||
200 | * @param string $dateTo End of dates range |
||
201 | * @param int $page Number of page, 1 by default |
||
202 | * |
||
203 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
204 | */ |
||
205 | public function getDateActions(string $dateFrom, string $dateTo, int $page = 1) |
||
206 | { |
||
207 | // Set HTTP params |
||
208 | $this->type = 'get'; |
||
209 | $this->endpoint = 'request-action/' . $dateFrom . '/' . $dateTo . '/' . $page; |
||
210 | |||
211 | return $this->done(); |
||
212 | } |
||
213 | |||
214 | /** |
||
215 | * Get updates requests by dates range |
||
216 | * |
||
217 | * @link https://api.u-on.ru/{key}/request/updated/{date_from}/{date_to}.{_format} |
||
218 | * |
||
219 | * @param string $dateFrom Start of dates range |
||
220 | * @param string $dateTo End of dates range |
||
221 | * @param int $page Number of page, 1 by default |
||
222 | * |
||
223 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
224 | */ |
||
225 | public function getUpdated(string $dateFrom, string $dateTo, int $page = 1) |
||
226 | { |
||
227 | // Set HTTP params |
||
228 | $this->type = 'get'; |
||
229 | $this->endpoint = 'requests/updated/' . $dateFrom . '/' . $dateTo . '/' . $page; |
||
230 | |||
231 | return $this->done(); |
||
232 | } |
||
233 | |||
234 | /** |
||
235 | * Get updates requests by dates range |
||
236 | * |
||
237 | * @link https://api.u-on.ru/{key}/requests/closed/{date_from}/{date_to}/{page}.{_format} |
||
238 | * |
||
239 | * @param string $dateFrom Start of dates range |
||
240 | * @param string $dateTo End of dates range |
||
241 | * @param int $page Number of page, 1 by default |
||
242 | * |
||
243 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
244 | */ |
||
245 | public function getClosed(string $dateFrom, string $dateTo, int $page = 1) |
||
246 | { |
||
247 | // Set HTTP params |
||
248 | $this->type = 'get'; |
||
249 | $this->endpoint = 'requests/closed/' . $dateFrom . '/' . $dateTo . '/' . $page; |
||
250 | |||
251 | return $this->done(); |
||
252 | } |
||
253 | |||
254 | /** |
||
255 | * Get all travel types or by some parameters, like id or name |
||
256 | * |
||
257 | * @link https://api.u-on.ru/{key}/travel-type.{_format} |
||
258 | * |
||
259 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
260 | */ |
||
261 | public function getTravelType() |
||
262 | { |
||
263 | // Set HTTP params |
||
264 | $this->type = 'get'; |
||
265 | $this->endpoint = 'travel-type'; |
||
266 | |||
267 | return $this->done(); |
||
268 | } |
||
269 | |||
270 | /** |
||
271 | * Get filled document from request |
||
272 | * |
||
273 | * @link https://api.u-on.ru/{key}/request-document.{_format} |
||
274 | * |
||
275 | * @param array $parameters List of parameters [template_id, request_id etc.] |
||
276 | * |
||
277 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
278 | */ |
||
279 | public function getDocument(array $parameters = []) |
||
0 ignored issues
–
show
|
|||
280 | { |
||
281 | // Set HTTP params |
||
282 | $this->type = 'get'; |
||
283 | $this->endpoint = 'request-document'; |
||
284 | |||
285 | return $this->done(); |
||
286 | } |
||
287 | |||
288 | /** |
||
289 | * Create new travel type |
||
290 | * |
||
291 | * @link https://api.u-on.ru/{key}/travel-type/create.{_format} |
||
292 | * |
||
293 | * @param array $parameters List of parameters [name] |
||
294 | * |
||
295 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
296 | */ |
||
297 | public function createTravelType(array $parameters) |
||
298 | { |
||
299 | // Set HTTP params |
||
300 | $this->type = 'post'; |
||
301 | $this->endpoint = 'travel-type/create'; |
||
302 | $this->params = $parameters; |
||
303 | |||
304 | return $this->done(); |
||
305 | } |
||
306 | |||
307 | /** |
||
308 | * Update request by request id |
||
309 | * |
||
310 | * @link https://api.u-on.ru/{key}/request/update/{id}.{_format} |
||
311 | * |
||
312 | * @param int $id Unique ID of request's |
||
313 | * @param array $parameters List of parameters [r_cl_id] |
||
314 | * |
||
315 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
316 | */ |
||
317 | public function update(int $id, array $parameters) |
||
318 | { |
||
319 | // Set HTTP params |
||
320 | $this->type = 'post'; |
||
321 | $this->endpoint = 'request/update/' . $id; |
||
322 | $this->params = $parameters; |
||
323 | |||
324 | return $this->done(); |
||
325 | } |
||
326 | |||
327 | /** |
||
328 | * Delete attached file from request |
||
329 | * |
||
330 | * @link https://api.u-on.ru/{key}/request-file/delete/{id}.{_format} |
||
331 | * |
||
332 | * @param int $id Unique ID of file |
||
333 | * |
||
334 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
335 | */ |
||
336 | public function deleteFile(int $id) |
||
337 | { |
||
338 | // Set HTTP params |
||
339 | $this->type = 'post'; |
||
340 | $this->endpoint = 'request/delete/' . $id; |
||
341 | |||
342 | return $this->done(); |
||
343 | } |
||
344 | |||
345 | /** |
||
346 | * Add tourist in request |
||
347 | * |
||
348 | * @link https://api.u-on.ru/{key}/tourists-requests/delete.{_format} |
||
349 | * |
||
350 | * @param array $parameters List of parameters [r_id, tourist_id] |
||
351 | * |
||
352 | * @return null|object|\Uon\Interfaces\ClientInterface |
||
353 | */ |
||
354 | public function deleteTourist(array $parameters) |
||
355 | { |
||
356 | // Set HTTP params |
||
357 | $this->type = 'post'; |
||
358 | $this->endpoint = 'tourists-requests/delete'; |
||
359 | $this->params = $parameters; |
||
360 | |||
361 | return $this->done(); |
||
362 | } |
||
363 | } |
||
364 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.