charitable
/
vendor
/
square
/
square
/
src
/
Locations
/
CustomAttributeDefinitions
/
Requests
/
CreateLocationCustomAttributeDefinitionRequest.php
CreateLocationCustomAttributeDefinitionRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Locations/CustomAttributeDefinitions/Requests/CreateLocationCustomAttributeDefinitionRequest.php
| 1 | <?php |
| 2 | |
| 3 | namespace Square\Locations\CustomAttributeDefinitions\Requests; |
| 4 | |
| 5 | use Square\Core\Json\JsonSerializableType; |
| 6 | use Square\Types\CustomAttributeDefinition; |
| 7 | use Square\Core\Json\JsonProperty; |
| 8 | |
| 9 | class CreateLocationCustomAttributeDefinitionRequest extends JsonSerializableType |
| 10 | { |
| 11 | /** |
| 12 | * The custom attribute definition to create. Note the following: |
| 13 | * - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema |
| 14 | * definition hosted on the Square CDN. For more information, including supported values and constraints, see |
| 15 | * [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). |
| 16 | * - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`. |
| 17 | * |
| 18 | * @var CustomAttributeDefinition $customAttributeDefinition |
| 19 | */ |
| 20 | #[JsonProperty('custom_attribute_definition')] |
| 21 | private CustomAttributeDefinition $customAttributeDefinition; |
| 22 | |
| 23 | /** |
| 24 | * A unique identifier for this request, used to ensure idempotency. For more information, |
| 25 | * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). |
| 26 | * |
| 27 | * @var ?string $idempotencyKey |
| 28 | */ |
| 29 | #[JsonProperty('idempotency_key')] |
| 30 | private ?string $idempotencyKey; |
| 31 | |
| 32 | /** |
| 33 | * @param array{ |
| 34 | * customAttributeDefinition: CustomAttributeDefinition, |
| 35 | * idempotencyKey?: ?string, |
| 36 | * } $values |
| 37 | */ |
| 38 | public function __construct( |
| 39 | array $values, |
| 40 | ) { |
| 41 | $this->customAttributeDefinition = $values['customAttributeDefinition']; |
| 42 | $this->idempotencyKey = $values['idempotencyKey'] ?? null; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @return CustomAttributeDefinition |
| 47 | */ |
| 48 | public function getCustomAttributeDefinition(): CustomAttributeDefinition |
| 49 | { |
| 50 | return $this->customAttributeDefinition; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param CustomAttributeDefinition $value |
| 55 | */ |
| 56 | public function setCustomAttributeDefinition(CustomAttributeDefinition $value): self |
| 57 | { |
| 58 | $this->customAttributeDefinition = $value; |
| 59 | return $this; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return ?string |
| 64 | */ |
| 65 | public function getIdempotencyKey(): ?string |
| 66 | { |
| 67 | return $this->idempotencyKey; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @param ?string $value |
| 72 | */ |
| 73 | public function setIdempotencyKey(?string $value = null): self |
| 74 | { |
| 75 | $this->idempotencyKey = $value; |
| 76 | return $this; |
| 77 | } |
| 78 | } |
| 79 |