1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* Event Request class
|
4
|
|
|
*/
|
5
|
|
|
namespace Twigger\UnionCloud\API\Request;
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
use Twigger\UnionCloud\API\Auth\Authentication;
|
9
|
|
|
use Twigger\UnionCloud\API\Configuration;
|
10
|
|
|
use Twigger\UnionCloud\API\Response\EventResponse;
|
11
|
|
|
|
12
|
|
|
/**
|
13
|
|
|
* Class Event Request
|
14
|
|
|
*
|
15
|
|
|
* @package Twigger\UnionCloud\API\Events\Events
|
16
|
|
|
*
|
17
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 GNU Public License v3
|
18
|
|
|
*
|
19
|
|
|
* @author Toby Twigger <[email protected]>
|
20
|
|
|
*
|
21
|
|
|
*/
|
22
|
|
|
class EventRequest extends BaseRequest implements IRequest
|
23
|
|
|
{
|
24
|
|
|
/**
|
25
|
|
|
* Event Request constructor.
|
26
|
|
|
*
|
27
|
|
|
* @param Authentication $authentication
|
28
|
|
|
* @param Configuration $configuration
|
29
|
|
|
*/
|
30
|
|
|
public function __construct($authentication, $configuration)
|
31
|
|
|
{
|
32
|
|
|
parent::__construct($authentication, $configuration, EventResponse::class);
|
33
|
|
|
}
|
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/**
|
37
|
|
|
* Gets the current instance
|
38
|
|
|
*
|
39
|
|
|
* @return $this
|
40
|
|
|
*
|
41
|
|
|
*/
|
42
|
|
|
public function getInstance()
|
43
|
|
|
{
|
44
|
|
|
return $this;
|
45
|
|
|
}
|
46
|
|
|
|
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/*
|
50
|
|
|
|--------------------------------------------------------------------------
|
51
|
|
|
| API Endpoint Definitions
|
52
|
|
|
|--------------------------------------------------------------------------
|
53
|
|
|
|
|
54
|
|
|
| Define your API endpoints below here
|
55
|
|
|
|
|
56
|
|
|
*/
|
57
|
|
|
|
58
|
|
|
/**
|
59
|
|
|
* Create an Event
|
60
|
|
|
*
|
61
|
|
|
* @param mixed[] $event Event parameters
|
62
|
|
|
*
|
63
|
|
|
* @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
|
64
|
|
|
*
|
65
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
66
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
|
67
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
|
68
|
|
|
*/
|
69
|
|
|
public function create($event)
|
70
|
|
|
{
|
71
|
|
|
$this->setAPIParameters(
|
72
|
|
|
'events',
|
73
|
|
|
'POST',
|
74
|
|
|
$event
|
75
|
|
|
);
|
76
|
|
|
|
77
|
|
|
$this->call();
|
78
|
|
|
|
79
|
|
|
return $this->getReturnDetails();
|
80
|
|
|
}
|
81
|
|
|
|
82
|
|
|
/**
|
83
|
|
|
* Update an Event
|
84
|
|
|
*
|
85
|
|
|
* @param integer $eventID ID of the event to update
|
86
|
|
|
* @param mixed[] $event Details of the event to update
|
87
|
|
|
*
|
88
|
|
|
* @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
|
89
|
|
|
*
|
90
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
91
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
|
92
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
|
93
|
|
|
*/
|
94
|
|
|
public function update($eventID, $event)
|
95
|
|
|
{
|
96
|
|
|
$this->setAPIParameters(
|
97
|
|
|
'events/'.$eventID,
|
98
|
|
|
'PUT',
|
99
|
|
|
$event
|
100
|
|
|
);
|
101
|
|
|
|
102
|
|
|
$this->call();
|
103
|
|
|
|
104
|
|
|
return $this->getReturnDetails();
|
105
|
|
|
}
|
106
|
|
|
|
107
|
|
|
/**
|
108
|
|
|
* Cancel an Event
|
109
|
|
|
*
|
110
|
|
|
* @param integer $eventID ID of the event to update
|
111
|
|
|
*
|
112
|
|
|
* @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
|
113
|
|
|
*
|
114
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
115
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
|
116
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
|
117
|
|
|
*/
|
118
|
|
|
public function cancel($eventID)
|
119
|
|
|
{
|
120
|
|
|
$this->setAPIParameters(
|
121
|
|
|
'events/'.$eventID.'/cancel',
|
122
|
|
|
'PUT'
|
123
|
|
|
);
|
124
|
|
|
|
125
|
|
|
$this->call();
|
126
|
|
|
|
127
|
|
|
return $this->getReturnDetails();
|
128
|
|
|
}
|
129
|
|
|
|
130
|
|
|
/**
|
131
|
|
|
* Get all Events in the Union
|
132
|
|
|
*
|
133
|
|
|
* @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
|
134
|
|
|
*
|
135
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
136
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
|
137
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
|
138
|
|
|
*/
|
139
|
|
|
public function getAll()
|
140
|
|
|
{
|
141
|
|
|
$this->setAPIParameters(
|
142
|
|
|
'events',
|
143
|
|
|
'GET'
|
144
|
|
|
);
|
145
|
|
|
|
146
|
|
|
$this->enableMode();
|
147
|
|
|
$this->enablePagination();
|
148
|
|
|
$this->enableTimes();
|
149
|
|
|
|
150
|
|
|
$this->call();
|
151
|
|
|
|
152
|
|
|
return $this->getReturnDetails();
|
153
|
|
|
}
|
154
|
|
|
|
155
|
|
|
/**
|
156
|
|
|
* Get a specific Event
|
157
|
|
|
*
|
158
|
|
|
* @param integer $eventID ID of the Event
|
159
|
|
|
*
|
160
|
|
|
* @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
|
161
|
|
|
*
|
162
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
163
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
|
164
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
|
165
|
|
|
*/
|
166
|
|
|
public function getByID($eventID)
|
167
|
|
|
{
|
168
|
|
|
$this->setAPIParameters(
|
169
|
|
|
'events/'.$eventID,
|
170
|
|
|
'GET'
|
171
|
|
|
);
|
172
|
|
|
|
173
|
|
|
$this->enableMode();
|
174
|
|
|
|
175
|
|
|
$this->call();
|
176
|
|
|
|
177
|
|
|
return $this->getReturnDetails();
|
178
|
|
|
}
|
179
|
|
|
|
180
|
|
|
/**
|
181
|
|
|
* Search for an Event
|
182
|
|
|
*
|
183
|
|
|
* @param mixed[] $searchParameters Associative array of search parameters
|
184
|
|
|
*
|
185
|
|
|
* @return $this|\Twigger\UnionCloud\API\Response\IResponse|\Twigger\UnionCloud\API\ResourceCollection
|
186
|
|
|
*
|
187
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
188
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Request\RequestHistoryNotFound
|
189
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Response\BaseResponseException
|
190
|
|
|
*/
|
191
|
|
|
public function search($searchParameters)
|
192
|
|
|
{
|
193
|
|
|
$this->setAPIParameters(
|
194
|
|
|
'events/search',
|
195
|
|
|
'POST',
|
196
|
|
|
$searchParameters
|
197
|
|
|
);
|
198
|
|
|
|
199
|
|
|
$this->enableMode();
|
200
|
|
|
$this->enablePagination();
|
201
|
|
|
|
202
|
|
|
$this->call();
|
203
|
|
|
|
204
|
|
|
return $this->getReturnDetails();
|
205
|
|
|
}
|
206
|
|
|
|
207
|
|
|
|
208
|
|
|
} |