charitable
/
vendor
/
square
/
square
/
src
/
Orders
/
CustomAttributeDefinitions
/
Requests
/
UpdateOrderCustomAttributeDefinitionRequest.php
UpdateOrderCustomAttributeDefinitionRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Orders/CustomAttributeDefinitions/Requests/UpdateOrderCustomAttributeDefinitionRequest.php
| 1 | <?php |
| 2 | |
| 3 | namespace Square\Orders\CustomAttributeDefinitions\Requests; |
| 4 | |
| 5 | use Square\Core\Json\JsonSerializableType; |
| 6 | use Square\Types\CustomAttributeDefinition; |
| 7 | use Square\Core\Json\JsonProperty; |
| 8 | |
| 9 | class UpdateOrderCustomAttributeDefinitionRequest extends JsonSerializableType |
| 10 | { |
| 11 | /** |
| 12 | * @var string $key The key of the custom attribute definition to update. |
| 13 | */ |
| 14 | private string $key; |
| 15 | |
| 16 | /** |
| 17 | * The custom attribute definition that contains the fields to update. This endpoint supports sparse updates, |
| 18 | * so only new or changed fields need to be included in the request. For more information, see |
| 19 | * [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields). |
| 20 | * |
| 21 | * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition. |
| 22 | * |
| 23 | * @var CustomAttributeDefinition $customAttributeDefinition |
| 24 | */ |
| 25 | #[JsonProperty('custom_attribute_definition')] |
| 26 | private CustomAttributeDefinition $customAttributeDefinition; |
| 27 | |
| 28 | /** |
| 29 | * A unique identifier for this request, used to ensure idempotency. |
| 30 | * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). |
| 31 | * |
| 32 | * @var ?string $idempotencyKey |
| 33 | */ |
| 34 | #[JsonProperty('idempotency_key')] |
| 35 | private ?string $idempotencyKey; |
| 36 | |
| 37 | /** |
| 38 | * @param array{ |
| 39 | * key: string, |
| 40 | * customAttributeDefinition: CustomAttributeDefinition, |
| 41 | * idempotencyKey?: ?string, |
| 42 | * } $values |
| 43 | */ |
| 44 | public function __construct( |
| 45 | array $values, |
| 46 | ) { |
| 47 | $this->key = $values['key']; |
| 48 | $this->customAttributeDefinition = $values['customAttributeDefinition']; |
| 49 | $this->idempotencyKey = $values['idempotencyKey'] ?? null; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @return string |
| 54 | */ |
| 55 | public function getKey(): string |
| 56 | { |
| 57 | return $this->key; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @param string $value |
| 62 | */ |
| 63 | public function setKey(string $value): self |
| 64 | { |
| 65 | $this->key = $value; |
| 66 | return $this; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @return CustomAttributeDefinition |
| 71 | */ |
| 72 | public function getCustomAttributeDefinition(): CustomAttributeDefinition |
| 73 | { |
| 74 | return $this->customAttributeDefinition; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @param CustomAttributeDefinition $value |
| 79 | */ |
| 80 | public function setCustomAttributeDefinition(CustomAttributeDefinition $value): self |
| 81 | { |
| 82 | $this->customAttributeDefinition = $value; |
| 83 | return $this; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @return ?string |
| 88 | */ |
| 89 | public function getIdempotencyKey(): ?string |
| 90 | { |
| 91 | return $this->idempotencyKey; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @param ?string $value |
| 96 | */ |
| 97 | public function setIdempotencyKey(?string $value = null): self |
| 98 | { |
| 99 | $this->idempotencyKey = $value; |
| 100 | return $this; |
| 101 | } |
| 102 | } |
| 103 |