PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / vendor / square / square / src / Legacy / Models / ListGiftCardActivitiesRequest.php

ListGiftCardActivitiesRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/ListGiftCardActivitiesRequest.php

402 lines 11.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * Returns a list of gift card activities. You can optionally specify a filter to retrieve a
11 * subset of activites.
12 */
13 class ListGiftCardActivitiesRequest implements \JsonSerializable
14 {
15 /**
16 * @var array
17 */
18 private $giftCardId = [];
19
20 /**
21 * @var array
22 */
23 private $type = [];
24
25 /**
26 * @var array
27 */
28 private $locationId = [];
29
30 /**
31 * @var array
32 */
33 private $beginTime = [];
34
35 /**
36 * @var array
37 */
38 private $endTime = [];
39
40 /**
41 * @var array
42 */
43 private $limit = [];
44
45 /**
46 * @var array
47 */
48 private $cursor = [];
49
50 /**
51 * @var array
52 */
53 private $sortOrder = [];
54
55 /**
56 * Returns Gift Card Id.
57 * If a gift card ID is provided, the endpoint returns activities related
58 * to the specified gift card. Otherwise, the endpoint returns all gift card activities for
59 * the seller.
60 */
61 public function getGiftCardId(): ?string
62 {
63 if (count($this->giftCardId) == 0) {
64 return null;
65 }
66 return $this->giftCardId['value'];
67 }
68
69 /**
70 * Sets Gift Card Id.
71 * If a gift card ID is provided, the endpoint returns activities related
72 * to the specified gift card. Otherwise, the endpoint returns all gift card activities for
73 * the seller.
74 *
75 * @maps gift_card_id
76 */
77 public function setGiftCardId(?string $giftCardId): void
78 {
79 $this->giftCardId['value'] = $giftCardId;
80 }
81
82 /**
83 * Unsets Gift Card Id.
84 * If a gift card ID is provided, the endpoint returns activities related
85 * to the specified gift card. Otherwise, the endpoint returns all gift card activities for
86 * the seller.
87 */
88 public function unsetGiftCardId(): void
89 {
90 $this->giftCardId = [];
91 }
92
93 /**
94 * Returns Type.
95 * If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of
96 * the specified type.
97 * Otherwise, the endpoint returns all types of gift card activities.
98 */
99 public function getType(): ?string
100 {
101 if (count($this->type) == 0) {
102 return null;
103 }
104 return $this->type['value'];
105 }
106
107 /**
108 * Sets Type.
109 * If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of
110 * the specified type.
111 * Otherwise, the endpoint returns all types of gift card activities.
112 *
113 * @maps type
114 */
115 public function setType(?string $type): void
116 {
117 $this->type['value'] = $type;
118 }
119
120 /**
121 * Unsets Type.
122 * If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of
123 * the specified type.
124 * Otherwise, the endpoint returns all types of gift card activities.
125 */
126 public function unsetType(): void
127 {
128 $this->type = [];
129 }
130
131 /**
132 * Returns Location Id.
133 * If a location ID is provided, the endpoint returns gift card activities for the specified location.
134 * Otherwise, the endpoint returns gift card activities for all locations.
135 */
136 public function getLocationId(): ?string
137 {
138 if (count($this->locationId) == 0) {
139 return null;
140 }
141 return $this->locationId['value'];
142 }
143
144 /**
145 * Sets Location Id.
146 * If a location ID is provided, the endpoint returns gift card activities for the specified location.
147 * Otherwise, the endpoint returns gift card activities for all locations.
148 *
149 * @maps location_id
150 */
151 public function setLocationId(?string $locationId): void
152 {
153 $this->locationId['value'] = $locationId;
154 }
155
156 /**
157 * Unsets Location Id.
158 * If a location ID is provided, the endpoint returns gift card activities for the specified location.
159 * Otherwise, the endpoint returns gift card activities for all locations.
160 */
161 public function unsetLocationId(): void
162 {
163 $this->locationId = [];
164 }
165
166 /**
167 * Returns Begin Time.
168 * The timestamp for the beginning of the reporting period, in RFC 3339 format.
169 * This start time is inclusive. The default value is the current time minus one year.
170 */
171 public function getBeginTime(): ?string
172 {
173 if (count($this->beginTime) == 0) {
174 return null;
175 }
176 return $this->beginTime['value'];
177 }
178
179 /**
180 * Sets Begin Time.
181 * The timestamp for the beginning of the reporting period, in RFC 3339 format.
182 * This start time is inclusive. The default value is the current time minus one year.
183 *
184 * @maps begin_time
185 */
186 public function setBeginTime(?string $beginTime): void
187 {
188 $this->beginTime['value'] = $beginTime;
189 }
190
191 /**
192 * Unsets Begin Time.
193 * The timestamp for the beginning of the reporting period, in RFC 3339 format.
194 * This start time is inclusive. The default value is the current time minus one year.
195 */
196 public function unsetBeginTime(): void
197 {
198 $this->beginTime = [];
199 }
200
201 /**
202 * Returns End Time.
203 * The timestamp for the end of the reporting period, in RFC 3339 format.
204 * This end time is inclusive. The default value is the current time.
205 */
206 public function getEndTime(): ?string
207 {
208 if (count($this->endTime) == 0) {
209 return null;
210 }
211 return $this->endTime['value'];
212 }
213
214 /**
215 * Sets End Time.
216 * The timestamp for the end of the reporting period, in RFC 3339 format.
217 * This end time is inclusive. The default value is the current time.
218 *
219 * @maps end_time
220 */
221 public function setEndTime(?string $endTime): void
222 {
223 $this->endTime['value'] = $endTime;
224 }
225
226 /**
227 * Unsets End Time.
228 * The timestamp for the end of the reporting period, in RFC 3339 format.
229 * This end time is inclusive. The default value is the current time.
230 */
231 public function unsetEndTime(): void
232 {
233 $this->endTime = [];
234 }
235
236 /**
237 * Returns Limit.
238 * If a limit is provided, the endpoint returns the specified number
239 * of results (or fewer) per page. The maximum value is 100. The default value is 50.
240 * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-
241 * apis/pagination).
242 */
243 public function getLimit(): ?int
244 {
245 if (count($this->limit) == 0) {
246 return null;
247 }
248 return $this->limit['value'];
249 }
250
251 /**
252 * Sets Limit.
253 * If a limit is provided, the endpoint returns the specified number
254 * of results (or fewer) per page. The maximum value is 100. The default value is 50.
255 * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-
256 * apis/pagination).
257 *
258 * @maps limit
259 */
260 public function setLimit(?int $limit): void
261 {
262 $this->limit['value'] = $limit;
263 }
264
265 /**
266 * Unsets Limit.
267 * If a limit is provided, the endpoint returns the specified number
268 * of results (or fewer) per page. The maximum value is 100. The default value is 50.
269 * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-
270 * apis/pagination).
271 */
272 public function unsetLimit(): void
273 {
274 $this->limit = [];
275 }
276
277 /**
278 * Returns Cursor.
279 * A pagination cursor returned by a previous call to this endpoint.
280 * Provide this cursor to retrieve the next set of results for the original query.
281 * If a cursor is not provided, the endpoint returns the first page of the results.
282 * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-
283 * apis/pagination).
284 */
285 public function getCursor(): ?string
286 {
287 if (count($this->cursor) == 0) {
288 return null;
289 }
290 return $this->cursor['value'];
291 }
292
293 /**
294 * Sets Cursor.
295 * A pagination cursor returned by a previous call to this endpoint.
296 * Provide this cursor to retrieve the next set of results for the original query.
297 * If a cursor is not provided, the endpoint returns the first page of the results.
298 * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-
299 * apis/pagination).
300 *
301 * @maps cursor
302 */
303 public function setCursor(?string $cursor): void
304 {
305 $this->cursor['value'] = $cursor;
306 }
307
308 /**
309 * Unsets Cursor.
310 * A pagination cursor returned by a previous call to this endpoint.
311 * Provide this cursor to retrieve the next set of results for the original query.
312 * If a cursor is not provided, the endpoint returns the first page of the results.
313 * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-
314 * apis/pagination).
315 */
316 public function unsetCursor(): void
317 {
318 $this->cursor = [];
319 }
320
321 /**
322 * Returns Sort Order.
323 * The order in which the endpoint returns the activities, based on `created_at`.
324 * - `ASC` - Oldest to newest.
325 * - `DESC` - Newest to oldest (default).
326 */
327 public function getSortOrder(): ?string
328 {
329 if (count($this->sortOrder) == 0) {
330 return null;
331 }
332 return $this->sortOrder['value'];
333 }
334
335 /**
336 * Sets Sort Order.
337 * The order in which the endpoint returns the activities, based on `created_at`.
338 * - `ASC` - Oldest to newest.
339 * - `DESC` - Newest to oldest (default).
340 *
341 * @maps sort_order
342 */
343 public function setSortOrder(?string $sortOrder): void
344 {
345 $this->sortOrder['value'] = $sortOrder;
346 }
347
348 /**
349 * Unsets Sort Order.
350 * The order in which the endpoint returns the activities, based on `created_at`.
351 * - `ASC` - Oldest to newest.
352 * - `DESC` - Newest to oldest (default).
353 */
354 public function unsetSortOrder(): void
355 {
356 $this->sortOrder = [];
357 }
358
359 /**
360 * Encode this object to JSON
361 *
362 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
363 * are set. (default: false)
364 *
365 * @return array|stdClass
366 */
367 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
368 public function jsonSerialize(bool $asArrayWhenEmpty = false)
369 {
370 $json = [];
371 if (!empty($this->giftCardId)) {
372 $json['gift_card_id'] = $this->giftCardId['value'];
373 }
374 if (!empty($this->type)) {
375 $json['type'] = $this->type['value'];
376 }
377 if (!empty($this->locationId)) {
378 $json['location_id'] = $this->locationId['value'];
379 }
380 if (!empty($this->beginTime)) {
381 $json['begin_time'] = $this->beginTime['value'];
382 }
383 if (!empty($this->endTime)) {
384 $json['end_time'] = $this->endTime['value'];
385 }
386 if (!empty($this->limit)) {
387 $json['limit'] = $this->limit['value'];
388 }
389 if (!empty($this->cursor)) {
390 $json['cursor'] = $this->cursor['value'];
391 }
392 if (!empty($this->sortOrder)) {
393 $json['sort_order'] = $this->sortOrder['value'];
394 }
395 $json = array_filter($json, function ($val) {
396 return $val !== null;
397 });
398
399 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
400 }
401 }
402