| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models; |
| 6 |
|
| 7 |
use stdClass; |
| 8 |
|
| 9 |
/** |
| 10 |
* Represents a create request for a `TeamMember` object. |
| 11 |
*/ |
| 12 |
class CreateTeamMemberRequest implements \JsonSerializable |
| 13 |
{ |
| 14 |
/** |
| 15 |
* @var string|null |
| 16 |
*/ |
| 17 |
private $idempotencyKey; |
| 18 |
|
| 19 |
/** |
| 20 |
* @var TeamMember|null |
| 21 |
*/ |
| 22 |
private $teamMember; |
| 23 |
|
| 24 |
/** |
| 25 |
* Returns Idempotency Key. |
| 26 |
* A unique string that identifies this `CreateTeamMember` request. |
| 27 |
* Keys can be any valid string, but must be unique for every request. |
| 28 |
* For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api- |
| 29 |
* patterns/idempotency). |
| 30 |
* |
| 31 |
* The minimum length is 1 and the maximum length is 45. |
| 32 |
*/ |
| 33 |
public function getIdempotencyKey(): ?string |
| 34 |
{ |
| 35 |
return $this->idempotencyKey; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Sets Idempotency Key. |
| 40 |
* A unique string that identifies this `CreateTeamMember` request. |
| 41 |
* Keys can be any valid string, but must be unique for every request. |
| 42 |
* For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api- |
| 43 |
* patterns/idempotency). |
| 44 |
* |
| 45 |
* The minimum length is 1 and the maximum length is 45. |
| 46 |
* |
| 47 |
* @maps idempotency_key |
| 48 |
*/ |
| 49 |
public function setIdempotencyKey(?string $idempotencyKey): void |
| 50 |
{ |
| 51 |
$this->idempotencyKey = $idempotencyKey; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Returns Team Member. |
| 56 |
* A record representing an individual team member for a business. |
| 57 |
*/ |
| 58 |
public function getTeamMember(): ?TeamMember |
| 59 |
{ |
| 60 |
return $this->teamMember; |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Sets Team Member. |
| 65 |
* A record representing an individual team member for a business. |
| 66 |
* |
| 67 |
* @maps team_member |
| 68 |
*/ |
| 69 |
public function setTeamMember(?TeamMember $teamMember): void |
| 70 |
{ |
| 71 |
$this->teamMember = $teamMember; |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Encode this object to JSON |
| 76 |
* |
| 77 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 78 |
* are set. (default: false) |
| 79 |
* |
| 80 |
* @return array|stdClass |
| 81 |
*/ |
| 82 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 83 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 84 |
{ |
| 85 |
$json = []; |
| 86 |
if (isset($this->idempotencyKey)) { |
| 87 |
$json['idempotency_key'] = $this->idempotencyKey; |
| 88 |
} |
| 89 |
if (isset($this->teamMember)) { |
| 90 |
$json['team_member'] = $this->teamMember; |
| 91 |
} |
| 92 |
$json = array_filter($json, function ($val) { |
| 93 |
return $val !== null; |
| 94 |
}); |
| 95 |
|
| 96 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 97 |
} |
| 98 |
} |
| 99 |
|