| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models; |
| 6 |
|
| 7 |
use stdClass; |
| 8 |
|
| 9 |
/** |
| 10 |
* Defines the body parameters that can be included in requests to the |
| 11 |
* [BulkRetrieveCustomers]($e/Customers/BulkRetrieveCustomers) endpoint. |
| 12 |
*/ |
| 13 |
class BulkRetrieveCustomersRequest implements \JsonSerializable |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @var string[] |
| 17 |
*/ |
| 18 |
private $customerIds; |
| 19 |
|
| 20 |
/** |
| 21 |
* @param string[] $customerIds |
| 22 |
*/ |
| 23 |
public function __construct(array $customerIds) |
| 24 |
{ |
| 25 |
$this->customerIds = $customerIds; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Returns Customer Ids. |
| 30 |
* The IDs of the [customer profiles](entity:Customer) to retrieve. |
| 31 |
* |
| 32 |
* @return string[] |
| 33 |
*/ |
| 34 |
public function getCustomerIds(): array |
| 35 |
{ |
| 36 |
return $this->customerIds; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Sets Customer Ids. |
| 41 |
* The IDs of the [customer profiles](entity:Customer) to retrieve. |
| 42 |
* |
| 43 |
* @required |
| 44 |
* @maps customer_ids |
| 45 |
* |
| 46 |
* @param string[] $customerIds |
| 47 |
*/ |
| 48 |
public function setCustomerIds(array $customerIds): void |
| 49 |
{ |
| 50 |
$this->customerIds = $customerIds; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Encode this object to JSON |
| 55 |
* |
| 56 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 57 |
* are set. (default: false) |
| 58 |
* |
| 59 |
* @return array|stdClass |
| 60 |
*/ |
| 61 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 62 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 63 |
{ |
| 64 |
$json = []; |
| 65 |
$json['customer_ids'] = $this->customerIds; |
| 66 |
$json = array_filter($json, function ($val) { |
| 67 |
return $val !== null; |
| 68 |
}); |
| 69 |
|
| 70 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 71 |
} |
| 72 |
} |
| 73 |
|