charitable
/
vendor
/
square
/
square
/
src
/
Legacy
/
Models
/
BatchRetrieveInventoryChangesRequest.php
BatchRetrieveInventoryChangesRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Legacy/Models/BatchRetrieveInventoryChangesRequest.php
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Square\Legacy\Models; |
| 6 | |
| 7 | use stdClass; |
| 8 | |
| 9 | class BatchRetrieveInventoryChangesRequest implements \JsonSerializable |
| 10 | { |
| 11 | /** |
| 12 | * @var array |
| 13 | */ |
| 14 | private $catalogObjectIds = []; |
| 15 | |
| 16 | /** |
| 17 | * @var array |
| 18 | */ |
| 19 | private $locationIds = []; |
| 20 | |
| 21 | /** |
| 22 | * @var array |
| 23 | */ |
| 24 | private $types = []; |
| 25 | |
| 26 | /** |
| 27 | * @var array |
| 28 | */ |
| 29 | private $states = []; |
| 30 | |
| 31 | /** |
| 32 | * @var array |
| 33 | */ |
| 34 | private $updatedAfter = []; |
| 35 | |
| 36 | /** |
| 37 | * @var array |
| 38 | */ |
| 39 | private $updatedBefore = []; |
| 40 | |
| 41 | /** |
| 42 | * @var array |
| 43 | */ |
| 44 | private $cursor = []; |
| 45 | |
| 46 | /** |
| 47 | * @var array |
| 48 | */ |
| 49 | private $limit = []; |
| 50 | |
| 51 | /** |
| 52 | * Returns Catalog Object Ids. |
| 53 | * The filter to return results by `CatalogObject` ID. |
| 54 | * The filter is only applicable when set. The default value is null. |
| 55 | * |
| 56 | * @return string[]|null |
| 57 | */ |
| 58 | public function getCatalogObjectIds(): ?array |
| 59 | { |
| 60 | if (count($this->catalogObjectIds) == 0) { |
| 61 | return null; |
| 62 | } |
| 63 | return $this->catalogObjectIds['value']; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Sets Catalog Object Ids. |
| 68 | * The filter to return results by `CatalogObject` ID. |
| 69 | * The filter is only applicable when set. The default value is null. |
| 70 | * |
| 71 | * @maps catalog_object_ids |
| 72 | * |
| 73 | * @param string[]|null $catalogObjectIds |
| 74 | */ |
| 75 | public function setCatalogObjectIds(?array $catalogObjectIds): void |
| 76 | { |
| 77 | $this->catalogObjectIds['value'] = $catalogObjectIds; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Unsets Catalog Object Ids. |
| 82 | * The filter to return results by `CatalogObject` ID. |
| 83 | * The filter is only applicable when set. The default value is null. |
| 84 | */ |
| 85 | public function unsetCatalogObjectIds(): void |
| 86 | { |
| 87 | $this->catalogObjectIds = []; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Returns Location Ids. |
| 92 | * The filter to return results by `Location` ID. |
| 93 | * The filter is only applicable when set. The default value is null. |
| 94 | * |
| 95 | * @return string[]|null |
| 96 | */ |
| 97 | public function getLocationIds(): ?array |
| 98 | { |
| 99 | if (count($this->locationIds) == 0) { |
| 100 | return null; |
| 101 | } |
| 102 | return $this->locationIds['value']; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Sets Location Ids. |
| 107 | * The filter to return results by `Location` ID. |
| 108 | * The filter is only applicable when set. The default value is null. |
| 109 | * |
| 110 | * @maps location_ids |
| 111 | * |
| 112 | * @param string[]|null $locationIds |
| 113 | */ |
| 114 | public function setLocationIds(?array $locationIds): void |
| 115 | { |
| 116 | $this->locationIds['value'] = $locationIds; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Unsets Location Ids. |
| 121 | * The filter to return results by `Location` ID. |
| 122 | * The filter is only applicable when set. The default value is null. |
| 123 | */ |
| 124 | public function unsetLocationIds(): void |
| 125 | { |
| 126 | $this->locationIds = []; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Returns Types. |
| 131 | * The filter to return results by `InventoryChangeType` values other than `TRANSFER`. |
| 132 | * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. |
| 133 | * |
| 134 | * @return string[]|null |
| 135 | */ |
| 136 | public function getTypes(): ?array |
| 137 | { |
| 138 | if (count($this->types) == 0) { |
| 139 | return null; |
| 140 | } |
| 141 | return $this->types['value']; |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Sets Types. |
| 146 | * The filter to return results by `InventoryChangeType` values other than `TRANSFER`. |
| 147 | * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. |
| 148 | * |
| 149 | * @maps types |
| 150 | * |
| 151 | * @param string[]|null $types |
| 152 | */ |
| 153 | public function setTypes(?array $types): void |
| 154 | { |
| 155 | $this->types['value'] = $types; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Unsets Types. |
| 160 | * The filter to return results by `InventoryChangeType` values other than `TRANSFER`. |
| 161 | * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. |
| 162 | */ |
| 163 | public function unsetTypes(): void |
| 164 | { |
| 165 | $this->types = []; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Returns States. |
| 170 | * The filter to return `ADJUSTMENT` query results by |
| 171 | * `InventoryState`. This filter is only applied when set. |
| 172 | * The default value is null. |
| 173 | * |
| 174 | * @return string[]|null |
| 175 | */ |
| 176 | public function getStates(): ?array |
| 177 | { |
| 178 | if (count($this->states) == 0) { |
| 179 | return null; |
| 180 | } |
| 181 | return $this->states['value']; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * Sets States. |
| 186 | * The filter to return `ADJUSTMENT` query results by |
| 187 | * `InventoryState`. This filter is only applied when set. |
| 188 | * The default value is null. |
| 189 | * |
| 190 | * @maps states |
| 191 | * |
| 192 | * @param string[]|null $states |
| 193 | */ |
| 194 | public function setStates(?array $states): void |
| 195 | { |
| 196 | $this->states['value'] = $states; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Unsets States. |
| 201 | * The filter to return `ADJUSTMENT` query results by |
| 202 | * `InventoryState`. This filter is only applied when set. |
| 203 | * The default value is null. |
| 204 | */ |
| 205 | public function unsetStates(): void |
| 206 | { |
| 207 | $this->states = []; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Returns Updated After. |
| 212 | * The filter to return results with their `calculated_at` value |
| 213 | * after the given time as specified in an RFC 3339 timestamp. |
| 214 | * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
| 215 | */ |
| 216 | public function getUpdatedAfter(): ?string |
| 217 | { |
| 218 | if (count($this->updatedAfter) == 0) { |
| 219 | return null; |
| 220 | } |
| 221 | return $this->updatedAfter['value']; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Sets Updated After. |
| 226 | * The filter to return results with their `calculated_at` value |
| 227 | * after the given time as specified in an RFC 3339 timestamp. |
| 228 | * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
| 229 | * |
| 230 | * @maps updated_after |
| 231 | */ |
| 232 | public function setUpdatedAfter(?string $updatedAfter): void |
| 233 | { |
| 234 | $this->updatedAfter['value'] = $updatedAfter; |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Unsets Updated After. |
| 239 | * The filter to return results with their `calculated_at` value |
| 240 | * after the given time as specified in an RFC 3339 timestamp. |
| 241 | * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
| 242 | */ |
| 243 | public function unsetUpdatedAfter(): void |
| 244 | { |
| 245 | $this->updatedAfter = []; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Returns Updated Before. |
| 250 | * The filter to return results with their `created_at` or `calculated_at` value |
| 251 | * strictly before the given time as specified in an RFC 3339 timestamp. |
| 252 | * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
| 253 | */ |
| 254 | public function getUpdatedBefore(): ?string |
| 255 | { |
| 256 | if (count($this->updatedBefore) == 0) { |
| 257 | return null; |
| 258 | } |
| 259 | return $this->updatedBefore['value']; |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * Sets Updated Before. |
| 264 | * The filter to return results with their `created_at` or `calculated_at` value |
| 265 | * strictly before the given time as specified in an RFC 3339 timestamp. |
| 266 | * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
| 267 | * |
| 268 | * @maps updated_before |
| 269 | */ |
| 270 | public function setUpdatedBefore(?string $updatedBefore): void |
| 271 | { |
| 272 | $this->updatedBefore['value'] = $updatedBefore; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * Unsets Updated Before. |
| 277 | * The filter to return results with their `created_at` or `calculated_at` value |
| 278 | * strictly before the given time as specified in an RFC 3339 timestamp. |
| 279 | * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). |
| 280 | */ |
| 281 | public function unsetUpdatedBefore(): void |
| 282 | { |
| 283 | $this->updatedBefore = []; |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Returns Cursor. |
| 288 | * A pagination cursor returned by a previous call to this endpoint. |
| 289 | * Provide this to retrieve the next set of results for the original query. |
| 290 | * |
| 291 | * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for |
| 292 | * more information. |
| 293 | */ |
| 294 | public function getCursor(): ?string |
| 295 | { |
| 296 | if (count($this->cursor) == 0) { |
| 297 | return null; |
| 298 | } |
| 299 | return $this->cursor['value']; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Sets Cursor. |
| 304 | * A pagination cursor returned by a previous call to this endpoint. |
| 305 | * Provide this to retrieve the next set of results for the original query. |
| 306 | * |
| 307 | * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for |
| 308 | * more information. |
| 309 | * |
| 310 | * @maps cursor |
| 311 | */ |
| 312 | public function setCursor(?string $cursor): void |
| 313 | { |
| 314 | $this->cursor['value'] = $cursor; |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Unsets Cursor. |
| 319 | * A pagination cursor returned by a previous call to this endpoint. |
| 320 | * Provide this to retrieve the next set of results for the original query. |
| 321 | * |
| 322 | * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for |
| 323 | * more information. |
| 324 | */ |
| 325 | public function unsetCursor(): void |
| 326 | { |
| 327 | $this->cursor = []; |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * Returns Limit. |
| 332 | * The number of [records](entity:InventoryChange) to return. |
| 333 | */ |
| 334 | public function getLimit(): ?int |
| 335 | { |
| 336 | if (count($this->limit) == 0) { |
| 337 | return null; |
| 338 | } |
| 339 | return $this->limit['value']; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Sets Limit. |
| 344 | * The number of [records](entity:InventoryChange) to return. |
| 345 | * |
| 346 | * @maps limit |
| 347 | */ |
| 348 | public function setLimit(?int $limit): void |
| 349 | { |
| 350 | $this->limit['value'] = $limit; |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * Unsets Limit. |
| 355 | * The number of [records](entity:InventoryChange) to return. |
| 356 | */ |
| 357 | public function unsetLimit(): void |
| 358 | { |
| 359 | $this->limit = []; |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * Encode this object to JSON |
| 364 | * |
| 365 | * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 366 | * are set. (default: false) |
| 367 | * |
| 368 | * @return array|stdClass |
| 369 | */ |
| 370 | #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 371 | public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 372 | { |
| 373 | $json = []; |
| 374 | if (!empty($this->catalogObjectIds)) { |
| 375 | $json['catalog_object_ids'] = $this->catalogObjectIds['value']; |
| 376 | } |
| 377 | if (!empty($this->locationIds)) { |
| 378 | $json['location_ids'] = $this->locationIds['value']; |
| 379 | } |
| 380 | if (!empty($this->types)) { |
| 381 | $json['types'] = $this->types['value']; |
| 382 | } |
| 383 | if (!empty($this->states)) { |
| 384 | $json['states'] = $this->states['value']; |
| 385 | } |
| 386 | if (!empty($this->updatedAfter)) { |
| 387 | $json['updated_after'] = $this->updatedAfter['value']; |
| 388 | } |
| 389 | if (!empty($this->updatedBefore)) { |
| 390 | $json['updated_before'] = $this->updatedBefore['value']; |
| 391 | } |
| 392 | if (!empty($this->cursor)) { |
| 393 | $json['cursor'] = $this->cursor['value']; |
| 394 | } |
| 395 | if (!empty($this->limit)) { |
| 396 | $json['limit'] = $this->limit['value']; |
| 397 | } |
| 398 | $json = array_filter($json, function ($val) { |
| 399 | return $val !== null; |
| 400 | }); |
| 401 | |
| 402 | return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 403 | } |
| 404 | } |
| 405 |