1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Rezdy\Endpoints; |
4
|
|
|
|
5
|
|
|
use Rezdy\Client; |
6
|
|
|
use Rezdy\Interfaces\AvailabilityInterface; |
7
|
|
|
use Rezdy\Interfaces\QueryInterface; |
8
|
|
|
|
9
|
|
|
class Availability extends Client implements AvailabilityInterface |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Create availability |
13
|
|
|
* |
14
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
15
|
|
|
*/ |
16
|
|
|
public function create(): QueryInterface |
17
|
|
|
{ |
18
|
|
|
// Set HTTP params |
19
|
|
|
$this->type = 'post'; |
20
|
|
|
$this->endpoint = '/availability'; |
21
|
|
|
|
22
|
|
|
return $this; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Update availability |
27
|
|
|
* |
28
|
|
|
* @param string $sessionId |
29
|
|
|
* |
30
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
31
|
|
|
*/ |
32
|
|
|
public function update(string $sessionId): QueryInterface |
33
|
|
|
{ |
34
|
|
|
// Set HTTP params |
35
|
|
|
$this->type = 'put'; |
36
|
|
|
$this->endpoint = '/availability/' . $sessionId; |
37
|
|
|
|
38
|
|
|
return $this; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Delete availability |
43
|
|
|
* |
44
|
|
|
* @param string $sessionId |
45
|
|
|
* |
46
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
47
|
|
|
*/ |
48
|
|
|
public function delete(string $sessionId): QueryInterface |
49
|
|
|
{ |
50
|
|
|
// Set HTTP params |
51
|
|
|
$this->type = 'delete'; |
52
|
|
|
$this->endpoint = '/availability/' . $sessionId; |
53
|
|
|
|
54
|
|
|
return $this; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Search availability |
59
|
|
|
* |
60
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
61
|
|
|
*/ |
62
|
|
|
public function search(): QueryInterface |
63
|
|
|
{ |
64
|
|
|
// Set HTTP params |
65
|
|
|
$this->type = 'get'; |
66
|
|
|
$this->endpoint = '/availability'; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Create availability batch |
73
|
|
|
* |
74
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
75
|
|
|
*/ |
76
|
|
|
public function createBatch(): QueryInterface |
77
|
|
|
{ |
78
|
|
|
// Set HTTP params |
79
|
|
|
$this->type = 'post'; |
80
|
|
|
$this->endpoint = '/availability/batch'; |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Update availability starting at |
87
|
|
|
* |
88
|
|
|
* @param string $productCode |
89
|
|
|
* @param string $startTimeLocal |
90
|
|
|
* |
91
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
92
|
|
|
*/ |
93
|
|
|
public function updateStartingAt(string $productCode, string $startTimeLocal): QueryInterface |
94
|
|
|
{ |
95
|
|
|
// Set HTTP params |
96
|
|
|
$this->type = 'put'; |
97
|
|
|
$this->endpoint = '/availability/product/' . $productCode . '/startTimeLocal/' . $startTimeLocal; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Delete availability starting at |
104
|
|
|
* |
105
|
|
|
* @param string $productCode |
106
|
|
|
* @param string $startTimeLocal |
107
|
|
|
* |
108
|
|
|
* @return \Rezdy\Interfaces\QueryInterface |
109
|
|
|
*/ |
110
|
|
|
public function deleteStartingAt(string $productCode, string $startTimeLocal): QueryInterface |
111
|
|
|
{ |
112
|
|
|
// Set HTTP params |
113
|
|
|
$this->type = 'delete'; |
114
|
|
|
$this->endpoint = '/availability/product/' . $productCode . '/startTimeLocal/' . $startTimeLocal; |
115
|
|
|
|
116
|
|
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
} |
120
|
|
|
|