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** + +
+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` +
+ **History changes**
diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDTest.php index e50422926e2..4ff0c093bb1 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDTest.php @@ -143,6 +143,19 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/in-store/key=test_storeKey/product-projections/test_ID?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->inStoreKeyWithStoreKeyValue('test_storeKey') + ->productProjections() + ->withId('test_ID') + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/in-store/key=test_storeKey/product-projections/test_ID?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyTest.php index a877207c80c..4300b165375 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyTest.php @@ -143,6 +143,19 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/in-store/key=test_storeKey/product-projections/key=test_key?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->inStoreKeyWithStoreKeyValue('test_storeKey') + ->productProjections() + ->withKey('test_key') + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/in-store/key=test_storeKey/product-projections/key=test_key?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsByIDTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsByIDTest.php index 0381f02ea42..66220644d6e 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsByIDTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsByIDTest.php @@ -139,6 +139,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/product-projections/test_ID?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductProjectionsByIDGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->productProjections() + ->withId('test_ID') + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/product-projections/test_ID?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductProjectionsByIDGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsKeyByKeyTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsKeyByKeyTest.php index 5df1d05a612..503d71b3e5c 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsKeyByKeyTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsKeyByKeyTest.php @@ -139,6 +139,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/product-projections/key=test_key?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductProjectionsKeyByKeyGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->productProjections() + ->withKey('test_key') + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/product-projections/key=test_key?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductProjectionsKeyByKeyGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php index 13a67a2b62f..7f273793c8f 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php @@ -294,6 +294,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/product-projections/search?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductProjectionsSearchGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->productProjections() + ->search() + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/product-projections/search?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductProjectionsSearchGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsTest.php index 7529c3340c6..52a9f4ba95a 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsTest.php @@ -148,6 +148,17 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/product-projections?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductProjectionsGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->productProjections() + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/product-projections?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductProjectionsGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDTest.php index 128cb648afa..648622af8c7 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsByIDTest.php @@ -140,6 +140,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/products/test_ID?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsByIDGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->withId('test_ID') + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/products/test_ID?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsByIDGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder @@ -222,6 +234,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'post', 'test_projectKey/products/test_ID?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsByIDPost_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->withId('test_ID') + ->post(null) + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'post', + 'test_projectKey/products/test_ID?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsByIDPost_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder @@ -293,6 +317,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'delete', 'test_projectKey/products/test_ID?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsByIDDelete_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->withId('test_ID') + ->delete() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'delete', + 'test_projectKey/products/test_ID?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsByIDDelete_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsKeyByKeyTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsKeyByKeyTest.php index 267d0316128..f0611dccc91 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsKeyByKeyTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsKeyByKeyTest.php @@ -139,6 +139,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/products/key=test_key?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsKeyByKeyGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->withKey('test_key') + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/products/key=test_key?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsKeyByKeyGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder @@ -221,6 +233,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'post', 'test_projectKey/products/key=test_key?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsKeyByKeyPost_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->withKey('test_key') + ->post(null) + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'post', + 'test_projectKey/products/key=test_key?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsKeyByKeyPost_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder @@ -292,6 +316,18 @@ function (ApiRequestBuilder $builder): RequestInterface { 'delete', 'test_projectKey/products/key=test_key?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsKeyByKeyDelete_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->withKey('test_key') + ->delete() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'delete', + 'test_projectKey/products/key=test_key?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsKeyByKeyDelete_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsTest.php index fe8c5c7756e..a48b718bc23 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductsTest.php @@ -148,6 +148,17 @@ function (ApiRequestBuilder $builder): RequestInterface { 'get', 'test_projectKey/products?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsGet_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->get() + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'get', + 'test_projectKey/products?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsGet_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder @@ -289,6 +300,17 @@ function (ApiRequestBuilder $builder): RequestInterface { 'post', 'test_projectKey/products?priceCustomerGroup=priceCustomerGroup', ], + 'ByProjectKeyProductsPost_withPriceCustomerGroupAssignments' => [ + function (ApiRequestBuilder $builder): RequestInterface { + return $builder + ->withProjectKey('test_projectKey') + ->products() + ->post(null) + ->withPriceCustomerGroupAssignments('priceCustomerGroupAssignments'); + }, + 'post', + 'test_projectKey/products?priceCustomerGroupAssignments=priceCustomerGroupAssignments', + ], 'ByProjectKeyProductsPost_withPriceChannel' => [ function (ApiRequestBuilder $builder): RequestInterface { return $builder diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet.php index 47d94cce366..9f5bea88e40 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet.php @@ -183,6 +183,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyInStore return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet.php index 919b22d5375..eeed2ee7034 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet.php @@ -183,6 +183,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyInStore return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsByIDGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsByIDGet.php index 4b012c52d25..64566096cb8 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsByIDGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsByIDGet.php @@ -184,6 +184,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductProjectionsByIDGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsGet.php index e7d4c12bf18..53729fc4975 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsGet.php @@ -187,6 +187,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductProjectionsGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsKeyByKeyGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsKeyByKeyGet.php index a5283565274..90ea72af471 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsKeyByKeyGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsKeyByKeyGet.php @@ -184,6 +184,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductProjectionsKeyByKeyGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php index bc317570663..64bc891e6d2 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php @@ -294,6 +294,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductProjectionsSearchGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDDelete.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDDelete.php index bd618cd742b..a227732d6d6 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDDelete.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDDelete.php @@ -178,6 +178,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsByIDDelete + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDGet.php index 3d1f0804649..4b5afaadb8e 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDGet.php @@ -172,6 +172,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsByIDGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDPost.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDPost.php index 0b0d1ef6f29..c13854b2fe4 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDPost.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsByIDPost.php @@ -177,6 +177,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsByIDPost + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsGet.php index 24b493a7681..2e2f74c30dd 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsGet.php @@ -184,6 +184,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyDelete.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyDelete.php index 63e8a62c0fc..cad03d3b1c3 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyDelete.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyDelete.php @@ -178,6 +178,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsKeyByKeyDelete + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyGet.php index 3f6e494d036..6ad26d3e906 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyGet.php @@ -172,6 +172,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsKeyByKeyGet + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyPost.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyPost.php index 28d9a74006c..b3e511cce0c 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyPost.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsKeyByKeyPost.php @@ -177,6 +177,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsKeyByKeyPost + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsPost.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsPost.php index 27034c93110..febe8607368 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsPost.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductsPost.php @@ -172,6 +172,15 @@ public function withPriceCustomerGroup($priceCustomerGroup): ByProjectKeyProduct return $this->withQueryParam('priceCustomerGroup', $priceCustomerGroup); } + /** + * + * @psalm-param scalar|scalar[] $priceCustomerGroupAssignments + */ + public function withPriceCustomerGroupAssignments($priceCustomerGroupAssignments): ByProjectKeyProductsPost + { + return $this->withQueryParam('priceCustomerGroupAssignments', $priceCustomerGroupAssignments); + } + /** * * @psalm-param scalar|scalar[] $priceChannel diff --git a/lib/commercetools-api/src/Client/Resource/PriceSelecting.php b/lib/commercetools-api/src/Client/Resource/PriceSelecting.php index 5f48d221e3d..4172be0e796 100644 --- a/lib/commercetools-api/src/Client/Resource/PriceSelecting.php +++ b/lib/commercetools-api/src/Client/Resource/PriceSelecting.php @@ -34,6 +34,12 @@ public function withPriceCountry(string $priceCountry); */ public function withPriceCustomerGroup(string $priceCustomerGroup); + /** + * @return ApiRequestInterface + * @psalm-return T + */ + public function withPriceCustomerGroupAssignments(string $priceCustomerGroupAssignments); + /** * @return ApiRequestInterface * @psalm-return T diff --git a/lib/commercetools-api/src/Models/Common/BaseResource.php b/lib/commercetools-api/src/Models/Common/BaseResource.php index 762876f4afa..f40ba462045 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResource.php +++ b/lib/commercetools-api/src/Models/Common/BaseResource.php @@ -107,6 +107,9 @@ use Commercetools\Api\Models\Message\CustomerEmailTokenCreatedMessage; use Commercetools\Api\Models\Message\CustomerEmailVerifiedMessage; use Commercetools\Api\Models\Message\CustomerFirstNameSetMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentAddedMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentRemovedMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentsSetMessage; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldAddedMessage; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldChangedMessage; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldRemovedMessage; diff --git a/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php b/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php index 4782981e9e0..d94b92ab10b 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php +++ b/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php @@ -206,6 +206,12 @@ use Commercetools\Api\Models\Message\CustomerEmailVerifiedMessageBuilder; use Commercetools\Api\Models\Message\CustomerFirstNameSetMessage; use Commercetools\Api\Models\Message\CustomerFirstNameSetMessageBuilder; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentAddedMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentAddedMessageBuilder; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentRemovedMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentRemovedMessageBuilder; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentsSetMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentsSetMessageBuilder; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldAddedMessage; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldAddedMessageBuilder; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldChangedMessage; diff --git a/lib/commercetools-api/src/Models/Common/BaseResourceModel.php b/lib/commercetools-api/src/Models/Common/BaseResourceModel.php index c60bcc585ef..8b0e389ea9b 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResourceModel.php +++ b/lib/commercetools-api/src/Models/Common/BaseResourceModel.php @@ -206,6 +206,12 @@ use Commercetools\Api\Models\Message\CustomerEmailVerifiedMessageModel; use Commercetools\Api\Models\Message\CustomerFirstNameSetMessage; use Commercetools\Api\Models\Message\CustomerFirstNameSetMessageModel; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentAddedMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentAddedMessageModel; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentRemovedMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentRemovedMessageModel; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentsSetMessage; +use Commercetools\Api\Models\Message\CustomerGroupAssignmentsSetMessageModel; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldAddedMessage; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldAddedMessageModel; use Commercetools\Api\Models\Message\CustomerGroupCustomFieldChangedMessage; diff --git a/lib/commercetools-api/src/Models/Customer/Customer.php b/lib/commercetools-api/src/Models/Customer/Customer.php index 697b1fa0efb..8a5e55d6dd0 100644 --- a/lib/commercetools-api/src/Models/Customer/Customer.php +++ b/lib/commercetools-api/src/Models/Customer/Customer.php @@ -47,6 +47,7 @@ interface Customer extends BaseResource public const FIELD_SALUTATION = 'salutation'; public const FIELD_STORES = 'stores'; public const FIELD_AUTHENTICATION_MODE = 'authenticationMode'; + public const FIELD_CUSTOMER_GROUP_ASSIGNMENTS = 'customerGroupAssignments'; /** *

Unique identifier of the Customer.

@@ -294,6 +295,14 @@ public function getStores(); */ public function getAuthenticationMode(); + /** + *

Customer Groups of the Customer.

+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments(); + /** * @param ?string $id */ @@ -443,4 +452,9 @@ public function setStores(?StoreKeyReferenceCollection $stores): void; * @param ?string $authenticationMode */ public function setAuthenticationMode(?string $authenticationMode): void; + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments): void; } diff --git a/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentAction.php b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentAction.php new file mode 100644 index 00000000000..a13cb3067c0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentAction.php @@ -0,0 +1,30 @@ +Customer Group to assign to the Customer.

+ * + + * @return null|CustomerGroupAssignmentDraft + */ + public function getCustomerGroupAssignment(); + + /** + * @param ?CustomerGroupAssignmentDraft $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupAssignmentDraft $customerGroupAssignment): void; +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionBuilder.php new file mode 100644 index 00000000000..a48a12f03fd --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerAddCustomerGroupAssignmentActionBuilder.php @@ -0,0 +1,73 @@ + + */ +final class CustomerAddCustomerGroupAssignmentActionBuilder implements Builder +{ + /** + + * @var null|CustomerGroupAssignmentDraft|CustomerGroupAssignmentDraftBuilder + */ + private $customerGroupAssignment; + + /** + *

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|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENT); + if (is_null($data)) { + return null; + } + + $this->customerGroupAssignment = CustomerGroupAssignmentDraftModel::of($data); + } + + return $this->customerGroupAssignment; + } + + + /** + * @param ?CustomerGroupAssignmentDraft $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupAssignmentDraft $customerGroupAssignment): void + { + $this->customerGroupAssignment = $customerGroupAssignment; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerBuilder.php index 2700f97d67a..af7b7d8549b 100644 --- a/lib/commercetools-api/src/Models/Customer/CustomerBuilder.php +++ b/lib/commercetools-api/src/Models/Customer/CustomerBuilder.php @@ -213,6 +213,12 @@ final class CustomerBuilder implements Builder */ private $authenticationMode; + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $customerGroupAssignments; + /** *

Unique 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.

@@ -507,6 +513,17 @@ public function getAuthenticationMode() return $this->authenticationMode; } + /** + *

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 ?list $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS); + if (is_null($data)) { + return null; + } + $this->customerGroupAssignments = CustomerGroupAssignmentDraftCollection::fromArray($data); + } + + return $this->customerGroupAssignments; + } + /** * @param ?string $key @@ -1035,6 +1063,14 @@ public function setAuthenticationMode(?string $authenticationMode): void $this->authenticationMode = $authenticationMode; } + /** + * @param ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments): void + { + $this->customerGroupAssignments = $customerGroupAssignments; + } + #[\ReturnTypeWillChange] public function jsonSerialize() diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignment.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignment.php new file mode 100644 index 00000000000..45866761f58 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignment.php @@ -0,0 +1,31 @@ +Reference to a Customer Group.

+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroup(); + + /** + * @param ?CustomerGroupReference $customerGroup + */ + public function setCustomerGroup(?CustomerGroupReference $customerGroup): void; +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentBuilder.php new file mode 100644 index 00000000000..fa2e9cc6f32 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomerGroupAssignmentBuilder implements Builder +{ + /** + + * @var null|CustomerGroupReference|CustomerGroupReferenceBuilder + */ + private $customerGroup; + + /** + *

Reference 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|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP); + if (is_null($data)) { + return null; + } + + $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data); + } + + return $this->customerGroup; + } + + + /** + * @param ?CustomerGroupResourceIdentifier $customerGroup + */ + public function setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup): void + { + $this->customerGroup = $customerGroup; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentModel.php b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentModel.php new file mode 100644 index 00000000000..20bf6865a7f --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerGroupAssignmentModel.php @@ -0,0 +1,69 @@ +customerGroup = $customerGroup; + } + + /** + *

Reference to a Customer Group.

+ * + * + * @return null|CustomerGroupReference + */ + public function getCustomerGroup() + { + if (is_null($this->customerGroup)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP); + if (is_null($data)) { + return null; + } + + $this->customerGroup = CustomerGroupReferenceModel::of($data); + } + + return $this->customerGroup; + } + + + /** + * @param ?CustomerGroupReference $customerGroup + */ + public function setCustomerGroup(?CustomerGroupReference $customerGroup): void + { + $this->customerGroup = $customerGroup; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerModel.php b/lib/commercetools-api/src/Models/Customer/CustomerModel.php index f8dc90c161b..3a68e9c783b 100644 --- a/lib/commercetools-api/src/Models/Customer/CustomerModel.php +++ b/lib/commercetools-api/src/Models/Customer/CustomerModel.php @@ -212,6 +212,12 @@ final class CustomerModel extends JsonObjectModel implements Customer */ protected $authenticationMode; + /** + * + * @var ?CustomerGroupAssignmentCollection + */ + protected $customerGroupAssignments; + /** * @psalm-suppress MissingParamType @@ -246,7 +252,8 @@ public function __construct( ?string $locale = null, ?string $salutation = null, ?StoreKeyReferenceCollection $stores = null, - ?string $authenticationMode = null + ?string $authenticationMode = null, + ?CustomerGroupAssignmentCollection $customerGroupAssignments = null ) { $this->id = $id; $this->version = $version; @@ -278,6 +285,7 @@ public function __construct( $this->salutation = $salutation; $this->stores = $stores; $this->authenticationMode = $authenticationMode; + $this->customerGroupAssignments = $customerGroupAssignments; } /** @@ -902,6 +910,26 @@ public function getAuthenticationMode() return $this->authenticationMode; } + /** + *

Customer Groups of the Customer.

+ * + * + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments() + { + if (is_null($this->customerGroupAssignments)) { + /** @psalm-var ?list $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS); + if (is_null($data)) { + return null; + } + $this->customerGroupAssignments = CustomerGroupAssignmentCollection::fromArray($data); + } + + return $this->customerGroupAssignments; + } + /** * @param ?string $id @@ -1143,6 +1171,14 @@ public function setAuthenticationMode(?string $authenticationMode): void $this->authenticationMode = $authenticationMode; } + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments): void + { + $this->customerGroupAssignments = $customerGroupAssignments; + } + #[\ReturnTypeWillChange] public function jsonSerialize() diff --git a/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentAction.php b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentAction.php new file mode 100644 index 00000000000..79abe6c56ac --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentAction.php @@ -0,0 +1,31 @@ +Customer Group to unassign from the Customer.

+ * + + * @return null|CustomerGroupResourceIdentifier + */ + public function getCustomerGroup(); + + /** + * @param ?CustomerGroupResourceIdentifier $customerGroup + */ + public function setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup): void; +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionBuilder.php new file mode 100644 index 00000000000..1d90ce78756 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerRemoveCustomerGroupAssignmentActionBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomerRemoveCustomerGroupAssignmentActionBuilder implements Builder +{ + /** + + * @var null|CustomerGroupResourceIdentifier|CustomerGroupResourceIdentifierBuilder + */ + private $customerGroup; + + /** + *

Customer 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|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP); + if (is_null($data)) { + return null; + } + + $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data); + } + + return $this->customerGroup; + } + + + /** + * @param ?CustomerGroupResourceIdentifier $customerGroup + */ + public function setCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup): void + { + $this->customerGroup = $customerGroup; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsAction.php b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsAction.php new file mode 100644 index 00000000000..a5f381b0dc9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsAction.php @@ -0,0 +1,30 @@ +Customer Groups to assign to the Customer.

+ * + + * @return null|CustomerGroupAssignmentDraftCollection + */ + public function getCustomerGroupAssignments(); + + /** + * @param ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments): void; +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionBuilder.php b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionBuilder.php new file mode 100644 index 00000000000..7faa8226f7b --- /dev/null +++ b/lib/commercetools-api/src/Models/Customer/CustomerSetCustomerGroupAssignmentsActionBuilder.php @@ -0,0 +1,63 @@ + + */ +final class CustomerSetCustomerGroupAssignmentsActionBuilder implements Builder +{ + /** + + * @var ?CustomerGroupAssignmentDraftCollection + */ + private $customerGroupAssignments; + + /** + *

Customer 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 ?list $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS); + if (is_null($data)) { + return null; + } + $this->customerGroupAssignments = CustomerGroupAssignmentDraftCollection::fromArray($data); + } + + return $this->customerGroupAssignments; + } + + + /** + * @param ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments): void + { + $this->customerGroupAssignments = $customerGroupAssignments; + } +} diff --git a/lib/commercetools-api/src/Models/Customer/CustomerUpdateActionModel.php b/lib/commercetools-api/src/Models/Customer/CustomerUpdateActionModel.php index dd9ed9ee2c8..89981201301 100644 --- a/lib/commercetools-api/src/Models/Customer/CustomerUpdateActionModel.php +++ b/lib/commercetools-api/src/Models/Customer/CustomerUpdateActionModel.php @@ -33,12 +33,14 @@ final class CustomerUpdateActionModel extends JsonObjectModel implements Custome private static $discriminatorClasses = [ 'addAddress' => CustomerAddAddressActionModel::class, 'addBillingAddressId' => CustomerAddBillingAddressIdActionModel::class, + 'addCustomerGroupAssignment' => CustomerAddCustomerGroupAssignmentActionModel::class, 'addShippingAddressId' => CustomerAddShippingAddressIdActionModel::class, 'addStore' => CustomerAddStoreActionModel::class, 'changeAddress' => CustomerChangeAddressActionModel::class, 'changeEmail' => CustomerChangeEmailActionModel::class, 'removeAddress' => CustomerRemoveAddressActionModel::class, 'removeBillingAddressId' => CustomerRemoveBillingAddressIdActionModel::class, + 'removeCustomerGroupAssignment' => CustomerRemoveCustomerGroupAssignmentActionModel::class, 'removeShippingAddressId' => CustomerRemoveShippingAddressIdActionModel::class, 'removeStore' => CustomerRemoveStoreActionModel::class, 'setAddressCustomField' => CustomerSetAddressCustomFieldActionModel::class, @@ -48,6 +50,7 @@ final class CustomerUpdateActionModel extends JsonObjectModel implements Custome 'setCustomField' => CustomerSetCustomFieldActionModel::class, 'setCustomType' => CustomerSetCustomTypeActionModel::class, 'setCustomerGroup' => CustomerSetCustomerGroupActionModel::class, + 'setCustomerGroupAssignments' => CustomerSetCustomerGroupAssignmentsActionModel::class, 'setCustomerNumber' => CustomerSetCustomerNumberActionModel::class, 'setDateOfBirth' => CustomerSetDateOfBirthActionModel::class, 'setDefaultBillingAddress' => CustomerSetDefaultBillingAddressActionModel::class, diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessage.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessage.php new file mode 100644 index 00000000000..2c77c4f6392 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessage.php @@ -0,0 +1,31 @@ +CustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.

+ * + + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment(); + + /** + * @param ?CustomerGroupAssignment $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupAssignment $customerGroupAssignment): void; +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageBuilder.php new file mode 100644 index 00000000000..1558e55d7ef --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessageBuilder.php @@ -0,0 +1,417 @@ + + */ +final class CustomerGroupAssignmentAddedMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var null|CustomerGroupAssignment|CustomerGroupAssignmentBuilder + */ + private $customerGroupAssignment; + + /** + *

Unique 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.

+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *

Date and time (UTC) the Message was generated.

+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *

Value of createdAt.

+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + *

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.

+ * + + * @return null|int + */ + public function getSequenceNumber() + { + return $this->sequenceNumber; + } + + /** + *

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.

+ * + + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers; + } + + /** + *

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.

+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *

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.

+ * + * + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + if (is_null($this->lastModifiedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastModifiedAt = $data; + } + + return $this->lastModifiedAt; + } + + /** + *

IDs and references that last modified the Message.

+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_BY); + if (is_null($data)) { + return null; + } + + $this->lastModifiedBy = LastModifiedByModel::of($data); + } + + return $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CREATED_BY); + if (is_null($data)) { + return null; + } + + $this->createdBy = CreatedByModel::of($data); + } + + return $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.

+ * + * + * @return null|int + */ + public function getSequenceNumber() + { + if (is_null($this->sequenceNumber)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_SEQUENCE_NUMBER); + if (is_null($data)) { + return null; + } + $this->sequenceNumber = (int) $data; + } + + return $this->sequenceNumber; + } + + /** + *

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|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE); + if (is_null($data)) { + return null; + } + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->resource = $className::of($data); + } + + return $this->resource; + } + + /** + *

Version 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.

+ * + * + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + if (is_null($this->resourceUserProvidedIdentifiers)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS); + if (is_null($data)) { + return null; + } + + $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data); + } + + return $this->resourceUserProvidedIdentifiers; + } + + /** + *

CustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.

+ * + * + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENT); + if (is_null($data)) { + return null; + } + + $this->customerGroupAssignment = CustomerGroupAssignmentModel::of($data); + } + + return $this->customerGroupAssignment; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?CustomerGroupAssignment $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupAssignment $customerGroupAssignment): void + { + $this->customerGroupAssignment = $customerGroupAssignment; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayload.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayload.php new file mode 100644 index 00000000000..34af58386d6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayload.php @@ -0,0 +1,31 @@ +CustomerGroupAssignment that was added during the Add CustomerGroupAssignment update action.

+ * + + * @return null|CustomerGroupAssignment + */ + public function getCustomerGroupAssignment(); + + /** + * @param ?CustomerGroupAssignment $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupAssignment $customerGroupAssignment): void; +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadBuilder.php new file mode 100644 index 00000000000..9e5ae84dfdf --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentAddedMessagePayloadBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomerGroupAssignmentAddedMessagePayloadBuilder implements Builder +{ + /** + + * @var null|CustomerGroupAssignment|CustomerGroupAssignmentBuilder + */ + private $customerGroupAssignment; + + /** + *

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 ?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|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENT); + if (is_null($data)) { + return null; + } + + $this->customerGroupAssignment = CustomerGroupAssignmentModel::of($data); + } + + return $this->customerGroupAssignment; + } + + + /** + * @param ?CustomerGroupAssignment $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupAssignment $customerGroupAssignment): void + { + $this->customerGroupAssignment = $customerGroupAssignment; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessage.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessage.php new file mode 100644 index 00000000000..4c94a4b108b --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessage.php @@ -0,0 +1,31 @@ +CustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.

+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment(); + + /** + * @param ?CustomerGroupReference $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupReference $customerGroupAssignment): void; +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageBuilder.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageBuilder.php new file mode 100644 index 00000000000..b0bf1923673 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessageBuilder.php @@ -0,0 +1,417 @@ + + */ +final class CustomerGroupAssignmentRemovedMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var null|CustomerGroupReference|CustomerGroupReferenceBuilder + */ + private $customerGroupAssignment; + + /** + *

Unique 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.

+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *

Date and time (UTC) the Message was generated.

+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *

Value of createdAt.

+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + *

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.

+ * + + * @return null|int + */ + public function getSequenceNumber() + { + return $this->sequenceNumber; + } + + /** + *

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.

+ * + + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers; + } + + /** + *

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.

+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *

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.

+ * + * + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + if (is_null($this->lastModifiedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastModifiedAt = $data; + } + + return $this->lastModifiedAt; + } + + /** + *

IDs and references that last modified the Message.

+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_BY); + if (is_null($data)) { + return null; + } + + $this->lastModifiedBy = LastModifiedByModel::of($data); + } + + return $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CREATED_BY); + if (is_null($data)) { + return null; + } + + $this->createdBy = CreatedByModel::of($data); + } + + return $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.

+ * + * + * @return null|int + */ + public function getSequenceNumber() + { + if (is_null($this->sequenceNumber)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_SEQUENCE_NUMBER); + if (is_null($data)) { + return null; + } + $this->sequenceNumber = (int) $data; + } + + return $this->sequenceNumber; + } + + /** + *

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|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE); + if (is_null($data)) { + return null; + } + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->resource = $className::of($data); + } + + return $this->resource; + } + + /** + *

Version 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.

+ * + * + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + if (is_null($this->resourceUserProvidedIdentifiers)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS); + if (is_null($data)) { + return null; + } + + $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data); + } + + return $this->resourceUserProvidedIdentifiers; + } + + /** + *

CustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.

+ * + * + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment() + { + if (is_null($this->customerGroupAssignment)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENT); + if (is_null($data)) { + return null; + } + + $this->customerGroupAssignment = CustomerGroupReferenceModel::of($data); + } + + return $this->customerGroupAssignment; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?CustomerGroupReference $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupReference $customerGroupAssignment): void + { + $this->customerGroupAssignment = $customerGroupAssignment; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayload.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayload.php new file mode 100644 index 00000000000..18920cae83e --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayload.php @@ -0,0 +1,31 @@ +CustomerGroupAssignment that was removed during the Remove CustomerGroupAssignment update action.

+ * + + * @return null|CustomerGroupReference + */ + public function getCustomerGroupAssignment(); + + /** + * @param ?CustomerGroupReference $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupReference $customerGroupAssignment): void; +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadBuilder.php new file mode 100644 index 00000000000..c1d1ce8ff0b --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentRemovedMessagePayloadBuilder.php @@ -0,0 +1,75 @@ + + */ +final class CustomerGroupAssignmentRemovedMessagePayloadBuilder implements Builder +{ + /** + + * @var null|CustomerGroupReference|CustomerGroupReferenceBuilder + */ + private $customerGroupAssignment; + + /** + *

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 ?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|array|null $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENT); + if (is_null($data)) { + return null; + } + + $this->customerGroupAssignment = CustomerGroupReferenceModel::of($data); + } + + return $this->customerGroupAssignment; + } + + + /** + * @param ?CustomerGroupReference $customerGroupAssignment + */ + public function setCustomerGroupAssignment(?CustomerGroupReference $customerGroupAssignment): void + { + $this->customerGroupAssignment = $customerGroupAssignment; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessage.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessage.php new file mode 100644 index 00000000000..6963c0c4e7c --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessage.php @@ -0,0 +1,31 @@ +List of CustomerGroupAssignments that were set during the Set CustomerGroupAssignments update action.

+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments(); + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments): void; +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageBuilder.php new file mode 100644 index 00000000000..21ba1de81d7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessageBuilder.php @@ -0,0 +1,405 @@ + + */ +final class CustomerGroupAssignmentsSetMessageBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + + * @var null|LastModifiedBy|LastModifiedByBuilder + */ + private $lastModifiedBy; + + /** + + * @var null|CreatedBy|CreatedByBuilder + */ + private $createdBy; + + /** + + * @var ?int + */ + private $sequenceNumber; + + /** + + * @var null|Reference|ReferenceBuilder + */ + private $resource; + + /** + + * @var ?int + */ + private $resourceVersion; + + /** + + * @var null|UserProvidedIdentifiers|UserProvidedIdentifiersBuilder + */ + private $resourceUserProvidedIdentifiers; + + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $customerGroupAssignments; + + /** + *

Unique 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.

+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + *

Date and time (UTC) the Message was generated.

+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *

Value of createdAt.

+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + *

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.

+ * + + * @return null|int + */ + public function getSequenceNumber() + { + return $this->sequenceNumber; + } + + /** + *

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.

+ * + + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers; + } + + /** + *

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.

+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + /** + *

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.

+ * + * + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + if (is_null($this->lastModifiedAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->lastModifiedAt = $data; + } + + return $this->lastModifiedAt; + } + + /** + *

IDs and references that last modified the Message.

+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_LAST_MODIFIED_BY); + if (is_null($data)) { + return null; + } + + $this->lastModifiedBy = LastModifiedByModel::of($data); + } + + return $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_CREATED_BY); + if (is_null($data)) { + return null; + } + + $this->createdBy = CreatedByModel::of($data); + } + + return $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.

+ * + * + * @return null|int + */ + public function getSequenceNumber() + { + if (is_null($this->sequenceNumber)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_SEQUENCE_NUMBER); + if (is_null($data)) { + return null; + } + $this->sequenceNumber = (int) $data; + } + + return $this->sequenceNumber; + } + + /** + *

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|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE); + if (is_null($data)) { + return null; + } + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->resource = $className::of($data); + } + + return $this->resource; + } + + /** + *

Version 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.

+ * + * + * @return null|UserProvidedIdentifiers + */ + public function getResourceUserProvidedIdentifiers() + { + if (is_null($this->resourceUserProvidedIdentifiers)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS); + if (is_null($data)) { + return null; + } + + $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data); + } + + return $this->resourceUserProvidedIdentifiers; + } + + /** + *

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 ?list $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS); + if (is_null($data)) { + return null; + } + $this->customerGroupAssignments = CustomerGroupAssignmentCollection::fromArray($data); + } + + return $this->customerGroupAssignments; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void + { + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + * @param ?LastModifiedBy $lastModifiedBy + */ + public function setLastModifiedBy(?LastModifiedBy $lastModifiedBy): void + { + $this->lastModifiedBy = $lastModifiedBy; + } + + /** + * @param ?CreatedBy $createdBy + */ + public function setCreatedBy(?CreatedBy $createdBy): void + { + $this->createdBy = $createdBy; + } + + /** + * @param ?int $sequenceNumber + */ + public function setSequenceNumber(?int $sequenceNumber): void + { + $this->sequenceNumber = $sequenceNumber; + } + + /** + * @param ?Reference $resource + */ + public function setResource(?Reference $resource): void + { + $this->resource = $resource; + } + + /** + * @param ?int $resourceVersion + */ + public function setResourceVersion(?int $resourceVersion): void + { + $this->resourceVersion = $resourceVersion; + } + + /** + * @param ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers + */ + public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers): void + { + $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; + } + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments): void + { + $this->customerGroupAssignments = $customerGroupAssignments; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayload.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayload.php new file mode 100644 index 00000000000..da771eda2bc --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayload.php @@ -0,0 +1,31 @@ +List of CustomerGroupAssignments that were set during the Set CustomerGroupAssignments update action.

+ * + + * @return null|CustomerGroupAssignmentCollection + */ + public function getCustomerGroupAssignments(); + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments): void; +} diff --git a/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadBuilder.php new file mode 100644 index 00000000000..1f397c32fc0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/CustomerGroupAssignmentsSetMessagePayloadBuilder.php @@ -0,0 +1,64 @@ + + */ +final class CustomerGroupAssignmentsSetMessagePayloadBuilder implements Builder +{ + /** + + * @var ?CustomerGroupAssignmentCollection + */ + private $customerGroupAssignments; + + /** + *

List 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 ?list $data */ + $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS); + if (is_null($data)) { + return null; + } + $this->customerGroupAssignments = CustomerGroupAssignmentCollection::fromArray($data); + } + + return $this->customerGroupAssignments; + } + + + /** + * @param ?CustomerGroupAssignmentCollection $customerGroupAssignments + */ + public function setCustomerGroupAssignments(?CustomerGroupAssignmentCollection $customerGroupAssignments): void + { + $this->customerGroupAssignments = $customerGroupAssignments; + } +} diff --git a/lib/commercetools-api/src/Models/Message/MessageModel.php b/lib/commercetools-api/src/Models/Message/MessageModel.php index fb3b4b9571b..42d480f8599 100644 --- a/lib/commercetools-api/src/Models/Message/MessageModel.php +++ b/lib/commercetools-api/src/Models/Message/MessageModel.php @@ -183,6 +183,9 @@ final class MessageModel extends JsonObjectModel implements Message 'CustomerEmailTokenCreated' => CustomerEmailTokenCreatedMessageModel::class, 'CustomerEmailVerified' => CustomerEmailVerifiedMessageModel::class, 'CustomerFirstNameSet' => CustomerFirstNameSetMessageModel::class, + 'CustomerGroupAssignmentAdded' => CustomerGroupAssignmentAddedMessageModel::class, + 'CustomerGroupAssignmentRemoved' => CustomerGroupAssignmentRemovedMessageModel::class, + 'CustomerGroupAssignmentsSet' => CustomerGroupAssignmentsSetMessageModel::class, 'CustomerGroupCustomFieldAdded' => CustomerGroupCustomFieldAddedMessageModel::class, 'CustomerGroupCustomFieldChanged' => CustomerGroupCustomFieldChangedMessageModel::class, 'CustomerGroupCustomFieldRemoved' => CustomerGroupCustomFieldRemovedMessageModel::class, diff --git a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php index 401067fccf2..9290d4b5ebb 100644 --- a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php @@ -114,6 +114,9 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'CustomerEmailTokenCreated' => CustomerEmailTokenCreatedMessagePayloadModel::class, 'CustomerEmailVerified' => CustomerEmailVerifiedMessagePayloadModel::class, 'CustomerFirstNameSet' => CustomerFirstNameSetMessagePayloadModel::class, + 'CustomerGroupAssignmentAdded' => CustomerGroupAssignmentAddedMessagePayloadModel::class, + 'CustomerGroupAssignmentRemoved' => CustomerGroupAssignmentRemovedMessagePayloadModel::class, + 'CustomerGroupAssignmentsSet' => CustomerGroupAssignmentsSetMessagePayloadModel::class, 'CustomerGroupCustomFieldAdded' => CustomerGroupCustomFieldAddedMessagePayloadModel::class, 'CustomerGroupCustomFieldChanged' => CustomerGroupCustomFieldChangedMessagePayloadModel::class, 'CustomerGroupCustomFieldRemoved' => CustomerGroupCustomFieldRemovedMessagePayloadModel::class, diff --git a/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParams.php b/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParams.php index 66e625ecaa7..06793799711 100644 --- a/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParams.php +++ b/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParams.php @@ -18,6 +18,7 @@ interface ProductSearchProjectionParams extends JsonObject public const FIELD_PRICE_CURRENCY = 'priceCurrency'; public const FIELD_PRICE_COUNTRY = 'priceCountry'; public const FIELD_PRICE_CUSTOMER_GROUP = 'priceCustomerGroup'; + public const FIELD_PRICE_CUSTOMER_GROUP_ASSIGNMENTS = 'priceCustomerGroupAssignments'; public const FIELD_PRICE_CHANNEL = 'priceChannel'; public const FIELD_LOCALE_PROJECTION = 'localeProjection'; public const FIELD_STORE_PROJECTION = 'storeProjection'; @@ -63,6 +64,14 @@ public function getPriceCountry(); */ public function getPriceCustomerGroup(); + /** + *

IDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups. Can only be used in conjunction with the priceCurrency parameter.

+ * + + * @return null|array + */ + public function getPriceCustomerGroupAssignments(); + /** *

id of an existing Channel used for Product price selection. Can only be used in conjunction with the priceCurrency parameter.

* @@ -116,6 +125,11 @@ public function setPriceCountry(?string $priceCountry): void; */ public function setPriceCustomerGroup(?string $priceCustomerGroup): void; + /** + * @param ?array $priceCustomerGroupAssignments + */ + public function setPriceCustomerGroupAssignments(?array $priceCustomerGroupAssignments): void; + /** * @param ?string $priceChannel */ diff --git a/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsBuilder.php b/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsBuilder.php index 386793a560c..977f7f9138f 100644 --- a/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsBuilder.php +++ b/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsBuilder.php @@ -50,6 +50,12 @@ final class ProductSearchProjectionParamsBuilder implements Builder */ private $priceCustomerGroup; + /** + + * @var ?array + */ + private $priceCustomerGroupAssignments; + /** * @var ?string @@ -124,6 +130,17 @@ public function getPriceCustomerGroup() return $this->priceCustomerGroup; } + /** + *

IDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups. Can only be used in conjunction with the priceCurrency parameter.

+ * + + * @return null|array + */ + public function getPriceCustomerGroupAssignments() + { + return $this->priceCustomerGroupAssignments; + } + /** *

id of an existing Channel used for Product price selection. Can only be used in conjunction with the priceCurrency parameter.

* @@ -216,6 +233,17 @@ public function withPriceCustomerGroup(?string $priceCustomerGroup) return $this; } + /** + * @param ?array $priceCustomerGroupAssignments + * @return $this + */ + public function withPriceCustomerGroupAssignments(?array $priceCustomerGroupAssignments) + { + $this->priceCustomerGroupAssignments = $priceCustomerGroupAssignments; + + return $this; + } + /** * @param ?string $priceChannel * @return $this @@ -258,6 +286,7 @@ public function build(): ProductSearchProjectionParams $this->priceCurrency, $this->priceCountry, $this->priceCustomerGroup, + $this->priceCustomerGroupAssignments, $this->priceChannel, $this->localeProjection, $this->storeProjection diff --git a/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsModel.php b/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsModel.php index ab68b3a0c4d..f2b72fa7abc 100644 --- a/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsModel.php +++ b/lib/commercetools-api/src/Models/ProductSearch/ProductSearchProjectionParamsModel.php @@ -49,6 +49,12 @@ final class ProductSearchProjectionParamsModel extends JsonObjectModel implement */ protected $priceCustomerGroup; + /** + * + * @var ?array + */ + protected $priceCustomerGroupAssignments; + /** * * @var ?string @@ -77,6 +83,7 @@ public function __construct( ?string $priceCurrency = null, ?string $priceCountry = null, ?string $priceCustomerGroup = null, + ?array $priceCustomerGroupAssignments = null, ?string $priceChannel = null, ?array $localeProjection = null, ?string $storeProjection = null @@ -86,6 +93,7 @@ public function __construct( $this->priceCurrency = $priceCurrency; $this->priceCountry = $priceCountry; $this->priceCustomerGroup = $priceCustomerGroup; + $this->priceCustomerGroupAssignments = $priceCustomerGroupAssignments; $this->priceChannel = $priceChannel; $this->localeProjection = $localeProjection; $this->storeProjection = $storeProjection; @@ -192,6 +200,26 @@ public function getPriceCustomerGroup() return $this->priceCustomerGroup; } + /** + *

IDs of existing CustomerGroups used for Product price selection, when using multiple Customer Groups. Can only be used in conjunction with the priceCurrency parameter.

+ * + * + * @return null|array + */ + public function getPriceCustomerGroupAssignments() + { + if (is_null($this->priceCustomerGroupAssignments)) { + /** @psalm-var ?list $data */ + $data = $this->raw(self::FIELD_PRICE_CUSTOMER_GROUP_ASSIGNMENTS); + if (is_null($data)) { + return null; + } + $this->priceCustomerGroupAssignments = $data; + } + + return $this->priceCustomerGroupAssignments; + } + /** *

id of an existing Channel used for Product price selection. Can only be used in conjunction with the priceCurrency parameter.

* @@ -297,6 +325,14 @@ public function setPriceCustomerGroup(?string $priceCustomerGroup): void $this->priceCustomerGroup = $priceCustomerGroup; } + /** + * @param ?array $priceCustomerGroupAssignments + */ + public function setPriceCustomerGroupAssignments(?array $priceCustomerGroupAssignments): void + { + $this->priceCustomerGroupAssignments = $priceCustomerGroupAssignments; + } + /** * @param ?string $priceChannel */ diff --git a/references.txt b/references.txt index 14487299e26..0abd1d36e6f 100644 --- a/references.txt +++ b/references.txt @@ -346,3 +346,4 @@ e8f731a742ca2997342b1b5f98121d86c8189a3b 473d2c6f1a9e9da0d2a42408ccf11f27a838f8b5 b7b82f5a701908239fcf39781bcbfa80823c9fa0 cc1732f88ea3dc336358ff9f39cda9d5271cf7c2 +7f090cdc5aadf54f73bb2ffe92dd19a828ed7e3a