1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Uon\Endpoints; |
4
|
|
|
|
5
|
|
|
use Uon\Client; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ExtendedFields |
9
|
|
|
* |
10
|
|
|
* @package Uon\Endpoints |
11
|
|
|
* @since 2.0 |
12
|
|
|
*/ |
13
|
|
|
class ExtendedFields extends Client |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Create new extended field |
17
|
|
|
* |
18
|
|
|
* @link https://api.u-on.ru/{key}/extended_field/create.{_format} |
19
|
|
|
* |
20
|
|
|
* @param array $parameters List of parameters |
21
|
|
|
* |
22
|
|
|
* @return null|object|\Uon\Interfaces\ClientInterface |
23
|
|
|
*/ |
24
|
|
|
public function create(array $parameters) |
25
|
|
|
{ |
26
|
|
|
// Set HTTP params |
27
|
|
|
$this->type = 'post'; |
28
|
|
|
$this->endpoint = 'extended_field/create'; |
29
|
|
|
$this->params = $parameters; |
30
|
|
|
|
31
|
|
|
return $this->done(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get list of all extended fields |
36
|
|
|
* |
37
|
|
|
* @link https://api.u-on.ru/{key}/extended_field/{page}.{_format |
38
|
|
|
* |
39
|
|
|
* @param int $page Number of page with extended fields |
40
|
|
|
* |
41
|
|
|
* @return null|object|\Uon\Interfaces\ClientInterface |
42
|
|
|
*/ |
43
|
|
|
public function all(int $page = 1) |
44
|
|
|
{ |
45
|
|
|
// Set HTTP params |
46
|
|
|
$this->type = 'get'; |
47
|
|
|
$this->endpoint = 'extended_field/' . $page; |
48
|
|
|
|
49
|
|
|
return $this->done(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Update extended field by ID |
54
|
|
|
* |
55
|
|
|
* @link https://api.u-on.ru/{key}/extended_field/update/{id}.{_format} |
56
|
|
|
* |
57
|
|
|
* @param int $id Unique country ID |
58
|
|
|
* @param array $parameters List of parameters |
59
|
|
|
* |
60
|
|
|
* @return null|object|\Uon\Interfaces\ClientInterface |
61
|
|
|
*/ |
62
|
|
|
public function update(int $id, array $parameters) |
63
|
|
|
{ |
64
|
|
|
// Set HTTP params |
65
|
|
|
$this->type = 'post'; |
66
|
|
|
$this->endpoint = 'extended_field/update/' . $id; |
67
|
|
|
$this->params = $parameters; |
68
|
|
|
|
69
|
|
|
return $this->done(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Delete selected extended field |
74
|
|
|
* |
75
|
|
|
* @link https://api.u-on.ru/{key}/extended_field/delete/{id}.{_format} |
76
|
|
|
* |
77
|
|
|
* @param int $id Unique hotel ID |
78
|
|
|
* |
79
|
|
|
* @return null|object|\Uon\Interfaces\ClientInterface |
80
|
|
|
*/ |
81
|
|
|
public function delete(int $id) |
82
|
|
|
{ |
83
|
|
|
// Set HTTP params |
84
|
|
|
$this->type = 'post'; |
85
|
|
|
$this->endpoint = 'extended_field/delete/' . $id; |
86
|
|
|
|
87
|
|
|
return $this->done(); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|