From 9676fdcaec4686fd904796a1dd673089f1b39f4a Mon Sep 17 00:00:00 2001
From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com>
Date: Tue, 7 Jan 2025 10:17:23 +0000
Subject: [PATCH] build(codegen): updating SDK
---
changes.md | 47 ++
...eyByStoreKeyProductProjectionsByIDTest.php | 13 +
...StoreKeyProductProjectionsKeyByKeyTest.php | 13 +
...ByProjectKeyProductProjectionsByIDTest.php | 12 +
...ojectKeyProductProjectionsKeyByKeyTest.php | 12 +
...ProjectKeyProductProjectionsSearchTest.php | 12 +
...urceByProjectKeyProductProjectionsTest.php | 11 +
.../ResourceByProjectKeyProductsByIDTest.php | 36 ++
...sourceByProjectKeyProductsKeyByKeyTest.php | 36 ++
.../ResourceByProjectKeyProductsTest.php | 22 +
...KeyByStoreKeyProductProjectionsByIDGet.php | 9 +
...yStoreKeyProductProjectionsKeyByKeyGet.php | 9 +
.../ByProjectKeyProductProjectionsByIDGet.php | 9 +
.../ByProjectKeyProductProjectionsGet.php | 9 +
...rojectKeyProductProjectionsKeyByKeyGet.php | 9 +
...yProjectKeyProductProjectionsSearchGet.php | 9 +
.../ByProjectKeyProductsByIDDelete.php | 9 +
.../Resource/ByProjectKeyProductsByIDGet.php | 9 +
.../Resource/ByProjectKeyProductsByIDPost.php | 9 +
.../Resource/ByProjectKeyProductsGet.php | 9 +
.../ByProjectKeyProductsKeyByKeyDelete.php | 9 +
.../ByProjectKeyProductsKeyByKeyGet.php | 9 +
.../ByProjectKeyProductsKeyByKeyPost.php | 9 +
.../Resource/ByProjectKeyProductsPost.php | 9 +
.../src/Client/Resource/PriceSelecting.php | 6 +
.../src/Models/Common/BaseResource.php | 3 +
.../src/Models/Common/BaseResourceBuilder.php | 6 +
.../src/Models/Common/BaseResourceModel.php | 6 +
.../src/Models/Customer/Customer.php | 14 +
...stomerAddCustomerGroupAssignmentAction.php | 30 ++
...ddCustomerGroupAssignmentActionBuilder.php | 73 +++
...ustomerGroupAssignmentActionCollection.php | 56 ++
...rAddCustomerGroupAssignmentActionModel.php | 94 ++++
.../src/Models/Customer/CustomerBuilder.php | 31 +-
.../src/Models/Customer/CustomerDraft.php | 14 +
.../Models/Customer/CustomerDraftBuilder.php | 31 +-
.../Models/Customer/CustomerDraftModel.php | 38 +-
.../Customer/CustomerGroupAssignment.php | 31 ++
.../CustomerGroupAssignmentBuilder.php | 75 +++
.../CustomerGroupAssignmentCollection.php | 56 ++
.../Customer/CustomerGroupAssignmentDraft.php | 31 ++
.../CustomerGroupAssignmentDraftBuilder.php | 75 +++
...CustomerGroupAssignmentDraftCollection.php | 56 ++
.../CustomerGroupAssignmentDraftModel.php | 69 +++
.../Customer/CustomerGroupAssignmentModel.php | 69 +++
.../src/Models/Customer/CustomerModel.php | 38 +-
...merRemoveCustomerGroupAssignmentAction.php | 31 ++
...veCustomerGroupAssignmentActionBuilder.php | 75 +++
...ustomerGroupAssignmentActionCollection.php | 56 ++
...moveCustomerGroupAssignmentActionModel.php | 96 ++++
...tomerSetCustomerGroupAssignmentsAction.php | 30 ++
...tCustomerGroupAssignmentsActionBuilder.php | 63 +++
...stomerGroupAssignmentsActionCollection.php | 56 ++
...SetCustomerGroupAssignmentsActionModel.php | 93 ++++
.../Customer/CustomerUpdateActionModel.php | 3 +
.../CustomerGroupAssignmentAddedMessage.php | 31 ++
...omerGroupAssignmentAddedMessageBuilder.php | 417 +++++++++++++++
...rGroupAssignmentAddedMessageCollection.php | 56 ++
...stomerGroupAssignmentAddedMessageModel.php | 493 ++++++++++++++++++
...omerGroupAssignmentAddedMessagePayload.php | 31 ++
...upAssignmentAddedMessagePayloadBuilder.php | 75 +++
...ssignmentAddedMessagePayloadCollection.php | 56 ++
...roupAssignmentAddedMessagePayloadModel.php | 96 ++++
.../CustomerGroupAssignmentRemovedMessage.php | 31 ++
...erGroupAssignmentRemovedMessageBuilder.php | 417 +++++++++++++++
...roupAssignmentRemovedMessageCollection.php | 56 ++
...omerGroupAssignmentRemovedMessageModel.php | 493 ++++++++++++++++++
...erGroupAssignmentRemovedMessagePayload.php | 31 ++
...AssignmentRemovedMessagePayloadBuilder.php | 75 +++
...ignmentRemovedMessagePayloadCollection.php | 56 ++
...upAssignmentRemovedMessagePayloadModel.php | 96 ++++
.../CustomerGroupAssignmentsSetMessage.php | 31 ++
...tomerGroupAssignmentsSetMessageBuilder.php | 405 ++++++++++++++
...erGroupAssignmentsSetMessageCollection.php | 56 ++
...ustomerGroupAssignmentsSetMessageModel.php | 491 +++++++++++++++++
...tomerGroupAssignmentsSetMessagePayload.php | 31 ++
...oupAssignmentsSetMessagePayloadBuilder.php | 64 +++
...AssignmentsSetMessagePayloadCollection.php | 56 ++
...GroupAssignmentsSetMessagePayloadModel.php | 94 ++++
.../src/Models/Message/MessageModel.php | 3 +
.../Models/Message/MessagePayloadModel.php | 3 +
.../ProductSearchProjectionParams.php | 14 +
.../ProductSearchProjectionParamsBuilder.php | 29 ++
.../ProductSearchProjectionParamsModel.php | 36 ++
references.txt | 1 +
85 files changed, 5565 insertions(+), 4 deletions(-)
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentAction.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionCollection.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionModel.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignment.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentCollection.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraft.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftCollection.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftModel.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentModel.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentAction.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionCollection.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionModel.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsAction.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionCollection.php
create mode 100644 lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionModel.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessage.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageCollection.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageModel.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayload.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadCollection.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadModel.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessage.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageCollection.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageModel.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayload.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadCollection.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadModel.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessage.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageCollection.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageModel.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayload.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadBuilder.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadCollection.php
create mode 100644 lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadModel.php
diff --git a/changes.md b/changes.md
index c2f8369d30e..f9188c9a520 100644
--- a/changes.md
+++ b/changes.md
@@ -1,3 +1,50 @@
+**Api changes**
+
+ Unique identifier of the Customer. Customer Groups of the Customer.Added Type(s)
+
+- added type `CustomerGroupAssignment`
+- added type `CustomerGroupAssignmentDraft`
+- added type `CustomerAddCustomerGroupAssignmentAction`
+- added type `CustomerRemoveCustomerGroupAssignmentAction`
+- added type `CustomerSetCustomerGroupAssignmentsAction`
+- added type `CustomerGroupAssignmentAddedMessage`
+- added type `CustomerGroupAssignmentRemovedMessage`
+- added type `CustomerGroupAssignmentsSetMessage`
+- added type `CustomerGroupAssignmentAddedMessagePayload`
+- added type `CustomerGroupAssignmentRemovedMessagePayload`
+- added type `CustomerGroupAssignmentsSetMessagePayload`
+Added QueryParameter(s)
+
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/products`
+- added query parameter `priceCustomerGroupAssignments` to method `post /{projectKey}/products`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/product-projections`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/products/key={key}`
+- added query parameter `priceCustomerGroupAssignments` to method `post /{projectKey}/products/key={key}`
+- added query parameter `priceCustomerGroupAssignments` to method `delete /{projectKey}/products/key={key}`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/products/{ID}`
+- added query parameter `priceCustomerGroupAssignments` to method `post /{projectKey}/products/{ID}`
+- added query parameter `priceCustomerGroupAssignments` to method `delete /{projectKey}/products/{ID}`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/product-projections/search`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/product-projections/key={key}`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/product-projections/{ID}`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/in-store/key={storeKey}/product-projections/key={key}`
+- added query parameter `priceCustomerGroupAssignments` to method `get /{projectKey}/in-store/key={storeKey}/product-projections/{ID}`
+Added Property(s)
+
+- added property `customerGroupAssignments` to type `Customer`
+- added property `customerGroupAssignments` to type `CustomerDraft`
+- added property `priceCustomerGroupAssignments` to type `ProductSearchProjectionParams`
+
Customer Group to assign to the Customer.
+ * + + * @return null|CustomerGroupAssignmentDraft + */ + public function getCustomerGroupAssignment() + { + return $this->customerGroupAssignment instanceof CustomerGroupAssignmentDraftBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment; + } + + /** + * @param ?CustomerGroupAssignmentDraft $customerGroupAssignment + * @return $this + */ + public function withCustomerGroupAssignment(?CustomerGroupAssignmentDraft $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + /** + * @deprecated use withCustomerGroupAssignment() instead + * @return $this + */ + public function withCustomerGroupAssignmentBuilder(?CustomerGroupAssignmentDraftBuilder $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + public function build(): CustomerAddCustomerGroupAssignmentAction + { + return new CustomerAddCustomerGroupAssignmentActionModel( + $this->customerGroupAssignment instanceof CustomerGroupAssignmentDraftBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment + ); + } + + public static function of(): CustomerAddCustomerGroupAssignmentActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionCollection.php b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionCollection.php new file mode 100644 index 00000000000..c5929824db8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerAddCustomerGroupAssignmentAction current() + * @method CustomerAddCustomerGroupAssignmentAction end() + * @method CustomerAddCustomerGroupAssignmentAction at($offset) + */ +class CustomerAddCustomerGroupAssignmentActionCollection extends CustomerUpdateActionCollection +{ + /** + * @psalm-assert CustomerAddCustomerGroupAssignmentAction $value + * @psalm-param CustomerAddCustomerGroupAssignmentAction|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerAddCustomerGroupAssignmentActionCollection + */ + public function add($value) + { + if (!$value instanceof CustomerAddCustomerGroupAssignmentAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerAddCustomerGroupAssignmentAction + */ + protected function mapper() + { + return function (?int $index): ?CustomerAddCustomerGroupAssignmentAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerAddCustomerGroupAssignmentAction $data */ + $data = CustomerAddCustomerGroupAssignmentActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionModel.php b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionModel.php new file mode 100644 index 00000000000..c1317f183e5 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionModel.php @@ -0,0 +1,94 @@ +customerGroupAssignment = $customerGroupAssignment; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Customer Group to assign to the Customer.
+ * + * + * @return null|CustomerGroupAssignmentDraft + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|arrayUnique identifier of the Customer.
* @@ -549,6 +555,17 @@ public function getAuthenticationMode() return $this->authenticationMode; } + /** + *Customer Groups of the Customer.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + return $this->customerGroupAssignments; + } + /** * @param ?string $id * @return $this @@ -879,6 +896,17 @@ public function withAuthenticationMode(?string $authenticationMode) return $this; } + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + * @return $this + */ + public function withCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments) + { + $this->customerGroupAssignments = $customerGroupAssignments; + + return $this; + } + /** * @deprecated use withLastModifiedBy() instead * @return $this @@ -955,7 +983,8 @@ public function build(): Customer $this->locale, $this->salutation, $this->stores, - $this->authenticationMode + $this->authenticationMode, + $this->customerGroupAssignments ); } diff --git a/lib/commercetools-api/src/Models/Customer/CustomerDraft.php b/lib/commercetools-api/src/Models/Customer/CustomerDraft.php index 260506fcd4d..cd4bc90b443 100644 --- a/lib/commercetools-api/src/Models/Customer/CustomerDraft.php +++ b/lib/commercetools-api/src/Models/Customer/CustomerDraft.php @@ -46,6 +46,7 @@ interface CustomerDraft extends JsonObject public const FIELD_SALUTATION = 'salutation'; public const FIELD_STORES = 'stores'; public const FIELD_AUTHENTICATION_MODE = 'authenticationMode'; + public const FIELD_CUSTOMER_GROUP_ASSIGNMENTS = 'customerGroupAssignments'; /** *User-defined unique identifier for the Customer. @@ -282,6 +283,14 @@ public function getStores(); */ public function getAuthenticationMode(); + /** + *
Customer Groups to assign to the Customer.
+ * + + * @return null|CustomerGroupAssignmentDraftCollection + */ + public function getCustomerGroupAssignments(); + /** * @param ?string $key */ @@ -416,4 +425,9 @@ public function setStores(?StoreResourceIdentifierCollection $stores): void; * @param ?string $authenticationMode */ public function setAuthenticationMode(?string $authenticationMode): void; + + /** + * @param ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments): void; } diff --git a/lib/commercetools-api/src/Models/Customer/CustomerDraftBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerDraftBuilder.php index 1d73e238ad6..34c66ffafaa 100644 --- a/lib/commercetools-api/src/Models/Customer/CustomerDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Customer/CustomerDraftBuilder.php @@ -191,6 +191,12 @@ final class CustomerDraftBuilder implements Builder */ private $authenticationMode; + /** + + * @var ?CustomerGroupAssignmentDraftCollection + */ + private $customerGroupAssignments; + /** *User-defined unique identifier for the Customer.
* The key
field is preferred over customerNumber
as it is mutable and provides more flexibility.
Customer Groups to assign to the Customer.
+ * + + * @return null|CustomerGroupAssignmentDraftCollection + */ + public function getCustomerGroupAssignments() + { + return $this->customerGroupAssignments; + } + /** * @param ?string $key * @return $this @@ -804,6 +821,17 @@ public function withAuthenticationMode(?string $authenticationMode) return $this; } + /** + * @param ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments + * @return $this + */ + public function withCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments) + { + $this->customerGroupAssignments = $customerGroupAssignments; + + return $this; + } + /** * @deprecated use withAnonymousCart() instead * @return $this @@ -866,7 +894,8 @@ public function build(): CustomerDraft $this->locale, $this->salutation, $this->stores, - $this->authenticationMode + $this->authenticationMode, + $this->customerGroupAssignments ); } diff --git a/lib/commercetools-api/src/Models/Customer/CustomerDraftModel.php b/lib/commercetools-api/src/Models/Customer/CustomerDraftModel.php index 15040dda562..5ec24a43a43 100644 --- a/lib/commercetools-api/src/Models/Customer/CustomerDraftModel.php +++ b/lib/commercetools-api/src/Models/Customer/CustomerDraftModel.php @@ -190,6 +190,12 @@ final class CustomerDraftModel extends JsonObjectModel implements CustomerDraft */ protected $authenticationMode; + /** + * + * @var ?CustomerGroupAssignmentDraftCollection + */ + protected $customerGroupAssignments; + /** * @psalm-suppress MissingParamType @@ -221,7 +227,8 @@ public function __construct( ?string $locale = null, ?string $salutation = null, ?StoreResourceIdentifierCollection $stores = null, - ?string $authenticationMode = null + ?string $authenticationMode = null, + ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments = null ) { $this->key = $key; $this->customerNumber = $customerNumber; @@ -250,6 +257,7 @@ public function __construct( $this->salutation = $salutation; $this->stores = $stores; $this->authenticationMode = $authenticationMode; + $this->customerGroupAssignments = $customerGroupAssignments; } /** @@ -818,6 +826,26 @@ public function getAuthenticationMode() return $this->authenticationMode; } + /** + *Customer Groups to assign to the Customer.
+ * + * + * @return null|CustomerGroupAssignmentDraftCollection + */ + public function getCustomerGroupAssignments() + { + if (is_null($this->customerGroupAssignments)) { + /** @psalm-var ?listReference to a Customer Group.
+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroup() + { + return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup; + } + + /** + * @param ?CustomerGroupReference $customerGroup + * @return $this + */ + public function withCustomerGroup(?CustomerGroupReference $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + /** + * @deprecated use withCustomerGroup() instead + * @return $this + */ + public function withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + public function build(): CustomerGroupAssignment + { + return new CustomerGroupAssignmentModel( + $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup + ); + } + + public static function of(): CustomerGroupAssignmentBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentCollection.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentCollection.php new file mode 100644 index 00000000000..ec083c12570 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignment current() + * @method CustomerGroupAssignment end() + * @method CustomerGroupAssignment at($offset) + */ +class CustomerGroupAssignmentCollection extends MapperSequence +{ + /** + * @psalm-assert CustomerGroupAssignment $value + * @psalm-param CustomerGroupAssignment|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignment) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignment + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignment { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignment $data */ + $data = CustomerGroupAssignmentModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraft.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraft.php new file mode 100644 index 00000000000..d9fff9ced6e --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraft.php @@ -0,0 +1,31 @@ +ResourceIdentifier of a Customer Group. + * + + * @return null|CustomerGroupResourceIdentifier + */ + public function getCustomerGroup(); + + /** + * @param ?CustomerGroupResourceIdentifier $customerGroup + */ + public function setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup): void; +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftBuilder.php new file mode 100644 index 00000000000..143a66cf803 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomerGroupAssignmentDraftBuilder implements Builder +{ + /** + + * @var null|CustomerGroupResourceIdentifier|CustomerGroupResourceIdentifierBuilder + */ + private $customerGroup; + + /** + *ResourceIdentifier of a Customer Group.
+ * + + * @return null|CustomerGroupResourceIdentifier + */ + public function getCustomerGroup() + { + return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup; + } + + /** + * @param ?CustomerGroupResourceIdentifier $customerGroup + * @return $this + */ + public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + /** + * @deprecated use withCustomerGroup() instead + * @return $this + */ + public function withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + public function build(): CustomerGroupAssignmentDraft + { + return new CustomerGroupAssignmentDraftModel( + $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup + ); + } + + public static function of(): CustomerGroupAssignmentDraftBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftCollection.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftCollection.php new file mode 100644 index 00000000000..8afd03d8505 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentDraft current() + * @method CustomerGroupAssignmentDraft end() + * @method CustomerGroupAssignmentDraft at($offset) + */ +class CustomerGroupAssignmentDraftCollection extends MapperSequence +{ + /** + * @psalm-assert CustomerGroupAssignmentDraft $value + * @psalm-param CustomerGroupAssignmentDraft|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentDraftCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentDraft) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentDraft + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentDraft { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentDraft $data */ + $data = CustomerGroupAssignmentDraftModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftModel.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftModel.php new file mode 100644 index 00000000000..6d59ef32842 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentDraftModel.php @@ -0,0 +1,69 @@ +customerGroup = $customerGroup; + } + + /** + *ResourceIdentifier of a Customer Group.
+ * + * + * @return null|CustomerGroupResourceIdentifier + */ + public function getCustomerGroup() + { + if (is_null($this->customerGroup)) { + /** @psalm-var stdClass|arrayReference to a Customer Group.
+ * + * + * @return null|CustomerGroupReference + */ + public function getCustomerGroup() + { + if (is_null($this->customerGroup)) { + /** @psalm-var stdClass|arrayCustomer Groups of the Customer.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + if (is_null($this->customerGroupAssignments)) { + /** @psalm-var ?listCustomer Group to unassign from the Customer.
+ * + + * @return null|CustomerGroupResourceIdentifier + */ + public function getCustomerGroup() + { + return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup; + } + + /** + * @param ?CustomerGroupResourceIdentifier $customerGroup + * @return $this + */ + public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + /** + * @deprecated use withCustomerGroup() instead + * @return $this + */ + public function withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup) + { + $this->customerGroup = $customerGroup; + + return $this; + } + + public function build(): CustomerRemoveCustomerGroupAssignmentAction + { + return new CustomerRemoveCustomerGroupAssignmentActionModel( + $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup + ); + } + + public static function of(): CustomerRemoveCustomerGroupAssignmentActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionCollection.php b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionCollection.php new file mode 100644 index 00000000000..dd49be9042c --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerRemoveCustomerGroupAssignmentAction current() + * @method CustomerRemoveCustomerGroupAssignmentAction end() + * @method CustomerRemoveCustomerGroupAssignmentAction at($offset) + */ +class CustomerRemoveCustomerGroupAssignmentActionCollection extends CustomerUpdateActionCollection +{ + /** + * @psalm-assert CustomerRemoveCustomerGroupAssignmentAction $value + * @psalm-param CustomerRemoveCustomerGroupAssignmentAction|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerRemoveCustomerGroupAssignmentActionCollection + */ + public function add($value) + { + if (!$value instanceof CustomerRemoveCustomerGroupAssignmentAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerRemoveCustomerGroupAssignmentAction + */ + protected function mapper() + { + return function (?int $index): ?CustomerRemoveCustomerGroupAssignmentAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerRemoveCustomerGroupAssignmentAction $data */ + $data = CustomerRemoveCustomerGroupAssignmentActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionModel.php b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionModel.php new file mode 100644 index 00000000000..9431239503d --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionModel.php @@ -0,0 +1,96 @@ +customerGroup = $customerGroup; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Customer Group to unassign from the Customer.
+ * + * + * @return null|CustomerGroupResourceIdentifier + */ + public function getCustomerGroup() + { + if (is_null($this->customerGroup)) { + /** @psalm-var stdClass|arrayCustomer Groups to assign to the Customer.
+ * + + * @return null|CustomerGroupAssignmentDraftCollection + */ + public function getCustomerGroupAssignments() + { + return $this->customerGroupAssignments; + } + + /** + * @param ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments + * @return $this + */ + public function withCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments) + { + $this->customerGroupAssignments = $customerGroupAssignments; + + return $this; + } + + + public function build(): CustomerSetCustomerGroupAssignmentsAction + { + return new CustomerSetCustomerGroupAssignmentsActionModel( + $this->customerGroupAssignments + ); + } + + public static function of(): CustomerSetCustomerGroupAssignmentsActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionCollection.php b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionCollection.php new file mode 100644 index 00000000000..ce66b60b065 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerSetCustomerGroupAssignmentsAction current() + * @method CustomerSetCustomerGroupAssignmentsAction end() + * @method CustomerSetCustomerGroupAssignmentsAction at($offset) + */ +class CustomerSetCustomerGroupAssignmentsActionCollection extends CustomerUpdateActionCollection +{ + /** + * @psalm-assert CustomerSetCustomerGroupAssignmentsAction $value + * @psalm-param CustomerSetCustomerGroupAssignmentsAction|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerSetCustomerGroupAssignmentsActionCollection + */ + public function add($value) + { + if (!$value instanceof CustomerSetCustomerGroupAssignmentsAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerSetCustomerGroupAssignmentsAction + */ + protected function mapper() + { + return function (?int $index): ?CustomerSetCustomerGroupAssignmentsAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerSetCustomerGroupAssignmentsAction $data */ + $data = CustomerSetCustomerGroupAssignmentsActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionModel.php b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionModel.php new file mode 100644 index 00000000000..fa6c3b7833f --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionModel.php @@ -0,0 +1,93 @@ +customerGroupAssignments = $customerGroupAssignments; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *Customer Groups to assign to the Customer.
+ * + * + * @return null|CustomerGroupAssignmentDraftCollection + */ + public function getCustomerGroupAssignments() + { + if (is_null($this->customerGroupAssignments)) { + /** @psalm-var ?listUnique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1
.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt
.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber
of the next Message for the resource is the successor of the sequenceNumber
of the current Message. Meaning, the sequenceNumber
of the next Message equals the sequenceNumber
of the current Message + 1.
+ * sequenceNumber
can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key
or externalId
. Only present if the resource has such identifiers.
CustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.
+ * + + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment() + { + return $this->customerGroupAssignment instanceof CustomerGroupAssignmentBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?CustomerGroupAssignment $customerGroupAssignment + * @return $this + */ + public function withCustomerGroupAssignment(?CustomerGroupAssignment $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @deprecated use withCustomerGroupAssignment() instead + * @return $this + */ + public function withCustomerGroupAssignmentBuilder(?CustomerGroupAssignmentBuilder $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + public function build(): CustomerGroupAssignmentAddedMessage + { + return new CustomerGroupAssignmentAddedMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->customerGroupAssignment instanceof CustomerGroupAssignmentBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment + ); + } + + public static function of(): CustomerGroupAssignmentAddedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageCollection.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageCollection.php new file mode 100644 index 00000000000..5a8899bbb9d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentAddedMessage current() + * @method CustomerGroupAssignmentAddedMessage end() + * @method CustomerGroupAssignmentAddedMessage at($offset) + */ +class CustomerGroupAssignmentAddedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert CustomerGroupAssignmentAddedMessage $value + * @psalm-param CustomerGroupAssignmentAddedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentAddedMessageCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentAddedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentAddedMessage + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentAddedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentAddedMessage $data */ + $data = CustomerGroupAssignmentAddedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageModel.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageModel.php new file mode 100644 index 00000000000..64faaa2e78f --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageModel.php @@ -0,0 +1,493 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->customerGroupAssignment = $customerGroupAssignment; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1
.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt
.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber
of the next Message for the resource is the successor of the sequenceNumber
of the current Message. Meaning, the sequenceNumber
of the next Message equals the sequenceNumber
of the current Message + 1.
+ * sequenceNumber
can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key
or externalId
. Only present if the resource has such identifiers.
CustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.
+ * + * + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|arrayCustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.
+ * + + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment() + { + return $this->customerGroupAssignment instanceof CustomerGroupAssignmentBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment; + } + + /** + * @param ?CustomerGroupAssignment $customerGroupAssignment + * @return $this + */ + public function withCustomerGroupAssignment(?CustomerGroupAssignment $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + /** + * @deprecated use withCustomerGroupAssignment() instead + * @return $this + */ + public function withCustomerGroupAssignmentBuilder(?CustomerGroupAssignmentBuilder $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + public function build(): CustomerGroupAssignmentAddedMessagePayload + { + return new CustomerGroupAssignmentAddedMessagePayloadModel( + $this->customerGroupAssignment instanceof CustomerGroupAssignmentBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment + ); + } + + public static function of(): CustomerGroupAssignmentAddedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadCollection.php new file mode 100644 index 00000000000..ce6ab91e8c5 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentAddedMessagePayload current() + * @method CustomerGroupAssignmentAddedMessagePayload end() + * @method CustomerGroupAssignmentAddedMessagePayload at($offset) + */ +class CustomerGroupAssignmentAddedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert CustomerGroupAssignmentAddedMessagePayload $value + * @psalm-param CustomerGroupAssignmentAddedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentAddedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentAddedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentAddedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentAddedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentAddedMessagePayload $data */ + $data = CustomerGroupAssignmentAddedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadModel.php new file mode 100644 index 00000000000..9f7ce9d3a33 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadModel.php @@ -0,0 +1,96 @@ +customerGroupAssignment = $customerGroupAssignment; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *CustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.
+ * + * + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|arrayUnique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1
.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt
.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber
of the next Message for the resource is the successor of the sequenceNumber
of the current Message. Meaning, the sequenceNumber
of the next Message equals the sequenceNumber
of the current Message + 1.
+ * sequenceNumber
can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key
or externalId
. Only present if the resource has such identifiers.
CustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.
+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment() + { + return $this->customerGroupAssignment instanceof CustomerGroupReferenceBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?CustomerGroupReference $customerGroupAssignment + * @return $this + */ + public function withCustomerGroupAssignment(?CustomerGroupReference $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @deprecated use withCustomerGroupAssignment() instead + * @return $this + */ + public function withCustomerGroupAssignmentBuilder(?CustomerGroupReferenceBuilder $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + public function build(): CustomerGroupAssignmentRemovedMessage + { + return new CustomerGroupAssignmentRemovedMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->customerGroupAssignment instanceof CustomerGroupReferenceBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment + ); + } + + public static function of(): CustomerGroupAssignmentRemovedMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageCollection.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageCollection.php new file mode 100644 index 00000000000..5d5010fb8ca --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentRemovedMessage current() + * @method CustomerGroupAssignmentRemovedMessage end() + * @method CustomerGroupAssignmentRemovedMessage at($offset) + */ +class CustomerGroupAssignmentRemovedMessageCollection extends MessageCollection +{ + /** + * @psalm-assert CustomerGroupAssignmentRemovedMessage $value + * @psalm-param CustomerGroupAssignmentRemovedMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentRemovedMessageCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentRemovedMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentRemovedMessage + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentRemovedMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentRemovedMessage $data */ + $data = CustomerGroupAssignmentRemovedMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageModel.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageModel.php new file mode 100644 index 00000000000..4bb9182966e --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageModel.php @@ -0,0 +1,493 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->customerGroupAssignment = $customerGroupAssignment; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1
.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt
.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber
of the next Message for the resource is the successor of the sequenceNumber
of the current Message. Meaning, the sequenceNumber
of the next Message equals the sequenceNumber
of the current Message + 1.
+ * sequenceNumber
can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key
or externalId
. Only present if the resource has such identifiers.
CustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.
+ * + * + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|arrayCustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.
+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment() + { + return $this->customerGroupAssignment instanceof CustomerGroupReferenceBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment; + } + + /** + * @param ?CustomerGroupReference $customerGroupAssignment + * @return $this + */ + public function withCustomerGroupAssignment(?CustomerGroupReference $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + /** + * @deprecated use withCustomerGroupAssignment() instead + * @return $this + */ + public function withCustomerGroupAssignmentBuilder(?CustomerGroupReferenceBuilder $customerGroupAssignment) + { + $this->customerGroupAssignment = $customerGroupAssignment; + + return $this; + } + + public function build(): CustomerGroupAssignmentRemovedMessagePayload + { + return new CustomerGroupAssignmentRemovedMessagePayloadModel( + $this->customerGroupAssignment instanceof CustomerGroupReferenceBuilder ? $this->customerGroupAssignment->build() : $this->customerGroupAssignment + ); + } + + public static function of(): CustomerGroupAssignmentRemovedMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadCollection.php new file mode 100644 index 00000000000..8ff59c916a7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentRemovedMessagePayload current() + * @method CustomerGroupAssignmentRemovedMessagePayload end() + * @method CustomerGroupAssignmentRemovedMessagePayload at($offset) + */ +class CustomerGroupAssignmentRemovedMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert CustomerGroupAssignmentRemovedMessagePayload $value + * @psalm-param CustomerGroupAssignmentRemovedMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentRemovedMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentRemovedMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentRemovedMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentRemovedMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentRemovedMessagePayload $data */ + $data = CustomerGroupAssignmentRemovedMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadModel.php new file mode 100644 index 00000000000..914203c9d84 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadModel.php @@ -0,0 +1,96 @@ +customerGroupAssignment = $customerGroupAssignment; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *CustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.
+ * + * + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|arrayUnique identifier of the Message. Can be used to track which Messages have been processed.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1
.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt
.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber
of the next Message for the resource is the successor of the sequenceNumber
of the current Message. Meaning, the sequenceNumber
of the next Message equals the sequenceNumber
of the current Message + 1.
+ * sequenceNumber
can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key
or externalId
. Only present if the resource has such identifiers.
List of CustomerGroupAssignments that were set during the Set CustomerGroupAssignments update action.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + return $this->customerGroupAssignments; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?int $version + * @return $this + */ + public function withVersion(?int $version) + { + $this->version = $version; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + * @return $this + */ + public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt) + { + $this->lastModifiedAt = $lastModifiedAt; + + return $this; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + * @return $this + */ + public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @param ?CreatedBy $createdBy + * @return $this + */ + public function withCreatedBy(?CreatedBy $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @param ?int $sequenceNumber + * @return $this + */ + public function withSequenceNumber(?int $sequenceNumber) + { + $this->sequenceNumber = $sequenceNumber; + + return $this; + } + + /** + * @param ?Reference $resource + * @return $this + */ + public function withResource(?Reference $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @param ?int $resourceVersion + * @return $this + */ + public function withResourceVersion(?int $resourceVersion) + { + $this->resourceVersion = $resourceVersion; + + return $this; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + * @return $this + */ + public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + * @return $this + */ + public function withCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments) + { + $this->customerGroupAssignments = $customerGroupAssignments; + + return $this; + } + + /** + * @deprecated use withLastModifiedBy() instead + * @return $this + */ + public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy) + { + $this->lastModifiedBy = $lastModifiedBy; + + return $this; + } + + /** + * @deprecated use withCreatedBy() instead + * @return $this + */ + public function withCreatedByBuilder(?CreatedByBuilder $createdBy) + { + $this->createdBy = $createdBy; + + return $this; + } + + /** + * @deprecated use withResource() instead + * @return $this + */ + public function withResourceBuilder(?ReferenceBuilder $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * @deprecated use withResourceUserProvidedIdentifiers() instead + * @return $this + */ + public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers) + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + + return $this; + } + + public function build(): CustomerGroupAssignmentsSetMessage + { + return new CustomerGroupAssignmentsSetMessageModel( + $this->id, + $this->version, + $this->createdAt, + $this->lastModifiedAt, + $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy, + $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy, + $this->sequenceNumber, + $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource, + $this->resourceVersion, + $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers, + $this->customerGroupAssignments + ); + } + + public static function of(): CustomerGroupAssignmentsSetMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageCollection.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageCollection.php new file mode 100644 index 00000000000..b2d140a2413 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentsSetMessage current() + * @method CustomerGroupAssignmentsSetMessage end() + * @method CustomerGroupAssignmentsSetMessage at($offset) + */ +class CustomerGroupAssignmentsSetMessageCollection extends MessageCollection +{ + /** + * @psalm-assert CustomerGroupAssignmentsSetMessage $value + * @psalm-param CustomerGroupAssignmentsSetMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentsSetMessageCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentsSetMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentsSetMessage + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentsSetMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentsSetMessage $data */ + $data = CustomerGroupAssignmentsSetMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageModel.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageModel.php new file mode 100644 index 00000000000..f45bbdc7aa7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageModel.php @@ -0,0 +1,491 @@ +id = $id; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + $this->lastModifiedBy = $lastModifiedBy; + $this->createdBy = $createdBy; + $this->sequenceNumber = $sequenceNumber; + $this->resource = $resource; + $this->resourceVersion = $resourceVersion; + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + $this->customerGroupAssignments = $customerGroupAssignments; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1
.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt
.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber
of the next Message for the resource is the successor of the sequenceNumber
of the current Message. Meaning, the sequenceNumber
of the next Message equals the sequenceNumber
of the current Message + 1.
+ * sequenceNumber
can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key
or externalId
. Only present if the resource has such identifiers.
List of CustomerGroupAssignments that were set during the Set CustomerGroupAssignments update action.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + if (is_null($this->customerGroupAssignments)) { + /** @psalm-var ?listList of CustomerGroupAssignments that were set during the Set CustomerGroupAssignments update action.
+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + return $this->customerGroupAssignments; + } + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + * @return $this + */ + public function withCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments) + { + $this->customerGroupAssignments = $customerGroupAssignments; + + return $this; + } + + + public function build(): CustomerGroupAssignmentsSetMessagePayload + { + return new CustomerGroupAssignmentsSetMessagePayloadModel( + $this->customerGroupAssignments + ); + } + + public static function of(): CustomerGroupAssignmentsSetMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadCollection.php new file mode 100644 index 00000000000..30399003350 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method CustomerGroupAssignmentsSetMessagePayload current() + * @method CustomerGroupAssignmentsSetMessagePayload end() + * @method CustomerGroupAssignmentsSetMessagePayload at($offset) + */ +class CustomerGroupAssignmentsSetMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert CustomerGroupAssignmentsSetMessagePayload $value + * @psalm-param CustomerGroupAssignmentsSetMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return CustomerGroupAssignmentsSetMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof CustomerGroupAssignmentsSetMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?CustomerGroupAssignmentsSetMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?CustomerGroupAssignmentsSetMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var CustomerGroupAssignmentsSetMessagePayload $data */ + $data = CustomerGroupAssignmentsSetMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadModel.php new file mode 100644 index 00000000000..b40b7ee5950 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadModel.php @@ -0,0 +1,94 @@ +customerGroupAssignments = $customerGroupAssignments; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *List of CustomerGroupAssignments that were set during the Set CustomerGroupAssignments update action.
+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + if (is_null($this->customerGroupAssignments)) { + /** @psalm-var ?listIDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups. Can only be used in conjunction with the priceCurrency
parameter.
id
of an existing Channel used for Product price selection. Can only be used in conjunction with the priceCurrency
parameter.
IDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups. Can only be used in conjunction with the priceCurrency
parameter.
id
of an existing Channel used for Product price selection. Can only be used in conjunction with the priceCurrency
parameter.
IDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups. Can only be used in conjunction with the priceCurrency
parameter.
id
of an existing Channel used for Product price selection. Can only be used in conjunction with the priceCurrency
parameter.