diff --git a/changes.md b/changes.md
index dbc7583b3d6..6b3bca11eba 100644
--- a/changes.md
+++ b/changes.md
@@ -14,6 +14,75 @@
+ New parent unit of the Business Unit. The new parent unit must have the same top-level unit as the old parent unit. New parent unit of the Business Unit.
+ * It must be associated with the same Stores, as the old parent unit. The Business Unit New parent unit of the Business Unit. The new parent unit must have the same top-level unit as the old parent unit. New parent unit of the Business Unit.
+ * It must be associated with the same Stores, as the old parent unit. The Business Unit New parent unit of the Business Unit. The new parent unit must have the same top-level unit as the old parent unit. New parent unit of the Business Unit.
+ * It must be associated with the same Stores, as the old parent unit. The Business Unit Changed Type(s)
+
+- :warning: changed type `DeliveryPayload` from type `object` to `SubscriptionNotification`
+Added Type(s)
+
+- added type `BusinessUnitAssociateResponse`
+- added type `BusinessUnitSetUnitTypeAction`
+- added type `BestDeal`
+- added type `DiscountTypeCombination`
+- added type `Stacking`
+- added type `CustomerGroupAssignment`
+- added type `CustomerGroupAssignmentDraft`
+- added type `CustomerAddCustomerGroupAssignmentAction`
+- added type `CustomerRemoveCustomerGroupAssignmentAction`
+- added type `CustomerSetCustomerGroupAssignmentsAction`
+- added type `BaseEvent`
+- added type `Event`
+- added type `ImportContainerCreatedEvent`
+- added type `ImportContainerCreatedEventData`
+- added type `ImportContainerDeletedEvent`
+- added type `ImportContainerDeletedEventData`
+- added type `ImportOperationRejectedEvent`
+- added type `ImportOperationRejectedEventData`
+- added type `ImportUnresolvedEvent`
+- added type `ImportUnresolvedEventData`
+- added type `ImportValidationFailedEvent`
+- added type `ImportValidationFailedEventData`
+- added type `ImportWaitForMasterVariantEvent`
+- added type `ImportWaitForMasterVariantEventData`
+- added type `AssociateRoleNameSetMessage`
+- added type `BusinessUnitTopLevelUnitSetMessage`
+- added type `BusinessUnitTypeSetMessage`
+- added type `CustomerGroupAssignmentAddedMessage`
+- added type `CustomerGroupAssignmentRemovedMessage`
+- added type `CustomerGroupAssignmentsSetMessage`
+- added type `OrderBusinessUnitSetMessage`
+- added type `AssociateRoleNameSetMessagePayload`
+- added type `BusinessUnitTopLevelUnitSetMessagePayload`
+- added type `BusinessUnitTypeSetMessagePayload`
+- added type `CustomerGroupAssignmentAddedMessagePayload`
+- added type `CustomerGroupAssignmentRemovedMessagePayload`
+- added type `CustomerGroupAssignmentsSetMessagePayload`
+- added type `OrderBusinessUnitSetMessagePayload`
+- added type `StagedOrderSetBusinessUnitAction`
+- added type `OrderSetBusinessUnitAction`
+- added type `ShoppingListSetBusinessUnitAction`
+- added type `EventDeliveryPayload`
+- added type `EventSubscription`
+- added type `EventSubscriptionResourceTypeId`
+- added type `EventType`
+- added type `SubscriptionNotification`
+- added type `SubscriptionSetEventsAction`
+Removed Type(s)
+
+- :warning: removed type `AssociateRoleNameChangedMessage`
+- :warning: removed type `AssociateRoleNameChangedMessagePayload`
+- :warning: removed type `ProductSearchFacetScope`
+Required Property(s)
@@ -44,6 +113,8 @@
- added property `priceCustomerGroupAssignments` to type `ProductSearchProjectionParams`
- added property `businessUnit` to type `ShoppingList`
- added property `businessUnit` to type `ShoppingListDraft`
+- added property `events` to type `Subscription`
+- added property `events` to type `SubscriptionDraft`
Added Type(s)
-
-- added type `BusinessUnitAssociateResponse`
-- added type `BestDeal`
-- added type `DiscountTypeCombination`
-- added type `Stacking`
-- added type `CustomerGroupAssignment`
-- added type `CustomerGroupAssignmentDraft`
-- added type `CustomerAddCustomerGroupAssignmentAction`
-- added type `CustomerRemoveCustomerGroupAssignmentAction`
-- added type `CustomerSetCustomerGroupAssignmentsAction`
-- added type `AssociateRoleNameSetMessage`
-- added type `CustomerGroupAssignmentAddedMessage`
-- added type `CustomerGroupAssignmentRemovedMessage`
-- added type `CustomerGroupAssignmentsSetMessage`
-- added type `OrderBusinessUnitSetMessage`
-- added type `AssociateRoleNameSetMessagePayload`
-- added type `CustomerGroupAssignmentAddedMessagePayload`
-- added type `CustomerGroupAssignmentRemovedMessagePayload`
-- added type `CustomerGroupAssignmentsSetMessagePayload`
-- added type `OrderBusinessUnitSetMessagePayload`
-- added type `StagedOrderSetBusinessUnitAction`
-- added type `OrderSetBusinessUnitAction`
-- added type `ShoppingListSetBusinessUnitAction`
-Removed Type(s)
-
-- :warning: removed type `AssociateRoleNameChangedMessage`
-- :warning: removed type `AssociateRoleNameChangedMessagePayload`
-- :warning: removed type `ProductSearchFacetScope`
-Added Resource(s)
diff --git a/lib/commercetools-api/docs/RequestBuilder.md b/lib/commercetools-api/docs/RequestBuilder.md
index dc0394aad19..a65389f85e6 100644
--- a/lib/commercetools-api/docs/RequestBuilder.md
+++ b/lib/commercetools-api/docs/RequestBuilder.md
@@ -63,7 +63,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->apiClients()->head()`
-Checks if an API Client exists for a given Query Predicate. Returns a `200 OK` status if any API Clients match the Query Predicate or a `404 Not Found` otherwise.
+Checks if an API Client exists for the provided query predicate. Returns a `200 OK` status if any API Clients match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -106,7 +106,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->apiClients()->withId("ID")->head()`
-Checks if an API Client exists for a given `id`. Returns a `200 OK` status if the API Client exists or a `404 Not Found` otherwise.
+Checks if an API Client exists with the provided `id`. Returns a `200 OK` status if the API Client exists or a `404 Not Found` otherwise.
### Example
```php
@@ -152,7 +152,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->businessUnits()->head()`
-Checks if a BusinessUnit exists for a given Query Predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more BusinessUnits exist for the provided query predicate. Returns a `200 OK` status if any BusinessUnits match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -201,7 +201,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->businessUnits()->withId("ID")->head()`
-Checks if a BusinessUnit exists for a given `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
+Checks if a BusinessUnit exists with the provided `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -252,7 +252,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->businessUnits()->withKey("key")->head()`
-Checks if a BusinessUnit exists for a given `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
+Checks if a BusinessUnit exists with the provided `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -462,7 +462,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->carts()->head()`
-Checks if a Cart exists for a given Query Predicate. Returns a `200 OK` status if any Carts match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Carts exist for the provided query predicate. Returns a `200 OK` status if any Carts match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -524,7 +524,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->carts()->withId("ID")->head()`
-Checks if a Cart exists for a given `id`. Returns a `200 OK` status if the Cart exists or a `404 Not Found` otherwise.
+Checks if a Cart exists with the provided `id`. Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -598,7 +598,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->carts()->withKey("key")->head()`
-Checks if a Cart exists for a given `key`. Returns a `200 OK` status if the Cart exists or a `404 Not Found` otherwise.
+Checks if a Cart exists with the provided `key`. Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -700,7 +700,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->orders()->head()`
-Checks if an Order exists for a given Query Predicate. Returns a `200 OK` status if any Orders match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Orders exist for the provided query predicate. Returns a `200 OK` status if any Orders match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -766,7 +766,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->orders()->withId("ID")->head()`
-Checks if an Order exists for a given `id`. Returns a `200 OK` status if the Order exists or a `404 Not Found` otherwise.
+Checks if an Order exists with the provided `id`. Returns a `200 OK` status if the Order exists or a `404 Not Found` otherwise.
### Example
```php
@@ -903,7 +903,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->quoteRequests()->head()`
-Checks if a QuoteRequest exists for a given Query Predicate. Returns a `200 OK` status if any QuoteRequests match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more QuoteRequests exist for the provided query predicate. Returns a `200 OK` status if any QuoteRequests match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -956,7 +956,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->quoteRequests()->withId("ID")->head()`
-Checks if a QuoteRequest exists for a given `id`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
+Checks if a QuoteRequest exists with the provided `id`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1012,7 +1012,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->quoteRequests()->withKey("key")->head()`
-Checks if a QuoteRequest exists for a given `key`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
+Checks if a QuoteRequest exists with the provided `key`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1066,7 +1066,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->quotes()->head()`
-Checks if a Quote exists for a given Query Predicate. Returns a `200 OK` status if any Quotes match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Quotes exist for the provided query predicate. Returns a `200 OK` status if any Quotes match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -1102,7 +1102,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->quotes()->withId("ID")->head()`
-Checks if a Quote exists for a given `id`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
+Checks if a Quote exists with the provided `id`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1158,7 +1158,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->quotes()->withKey("key")->head()`
-Checks if a Quote exists for a given `key`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
+Checks if a Quote exists with the provided `key`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1212,7 +1212,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->shoppingLists()->head()`
-Checks if a ShoppingList exists for a given Query Predicate. Returns a `200 OK` if any ShoppingLists match the Query Predicate; otherwise, returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
+Checks if one or more ShoppingLists exist for the provided query predicate. Returns a `200 OK` if any ShoppingLists match the Query Predicate; otherwise, returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
### Example
@@ -1267,7 +1267,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->shoppingLists()->withId("ID")->head()`
-Checks if a ShoppingList exists for a given `id`. Returns a `200 OK` if the ShoppingList exists; otherwise, returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
+Checks if a ShoppingList exists with the provided `id`. Returns a `200 OK` if the ShoppingList exists; otherwise, returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
### Example
@@ -1343,7 +1343,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->asAssociate()->withAssociateIdValue("associateId")->inBusinessUnitKeyWithBusinessUnitKeyValue("businessUnitKey")->shoppingLists()->withKey("key")->head()`
-Checks if a ShoppingList exists for a given `key`. Returns a `200 OK` if the ShoppingList exists; otherwise, returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
+Checks if a ShoppingList exists with the provided `key`. Returns a `200 OK` if the ShoppingList exists; otherwise, returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
### Example
@@ -1414,7 +1414,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->associateRoles()->head()`
-Checks if an AssociateRole exists for a given Query Predicate. Returns a `200 OK` status if any AssociateRole match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more AssociateRoles exist for the provided query predicate. Returns a `200 OK` status if any AssociateRole match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -1458,7 +1458,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->associateRoles()->withId("ID")->head()`
-Checks if an AssociateRole exists for a given `id`. Returns a `200 OK` status if the AssociateRole exists or a `404 Not Found` otherwise.
+Checks if an AssociateRole exists with the provided `id`. Returns a `200 OK` status if the AssociateRole exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1518,7 +1518,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->associateRoles()->withKey("key")->head()`
-Checks if an AssociateRole exists for a given `key`. Returns a `200 OK` status if the AssociateRole exists or a `404 Not Found` otherwise.
+Checks if an AssociateRole exists with the provided `key`. Returns a `200 OK` status if the AssociateRole exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1578,7 +1578,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->attributeGroups()->head()`
-Checks if an AttributeGroup exists for a given Query Predicate. Returns `200 OK` status if any AttributeGroups match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more AttributeGroups exist for the provided query predicate. Returns `200 OK` status if any AttributeGroups match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -1621,7 +1621,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->attributeGroups()->withId("ID")->head()`
-Checks if an AttributeGroup exists for a given `id`. Returns a `200 OK` status if the AttributeGroup exists or a `404 Not Found` otherwise.
+Checks if an AttributeGroup exists with the provided `id`. Returns a `200 OK` status if the AttributeGroup exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1681,7 +1681,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->attributeGroups()->withKey("key")->head()`
-Checks if an AttributeGroup exists for a given `key`. Returns `200 OK` status if the AttributeGroup exists or a `404 Not Found` otherwise.
+Checks if an AttributeGroup exists with the provided `key`. Returns `200 OK` status if the AttributeGroup exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1740,7 +1740,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->businessUnits()->head()`
-Checks if a BusinessUnit exists for a given Query Predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more BusinessUnits exist for the provided query predicate. Returns a `200 OK` status if any BusinessUnits match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -1799,7 +1799,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->businessUnits()->withId("ID")->head()`
-Checks if a BusinessUnit exists for a given `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
+Checks if a BusinessUnit exists with the provided `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1859,7 +1859,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->businessUnits()->withKey("key")->head()`
-Checks if a BusinessUnit exists for a given `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
+Checks if a BusinessUnit exists with the provided `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -1983,7 +1983,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->cartDiscounts()->head()`
-Checks if a CartDiscount exists for a given Query Predicate. Returns a `200 OK` status if any CartDiscounts match the Query Predicate, or a `404 Not Found` otherwise.
+Checks if one or more CartDiscounts exist for the provided query predicate. Returns a `200 OK` status if any CartDiscounts match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -2026,7 +2026,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->cartDiscounts()->withId("ID")->head()`
-Checks if a CartDiscount exists for a given `id`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
+Checks if a CartDiscount exists with the provided `id`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2086,7 +2086,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->cartDiscounts()->withKey("key")->head()`
-Checks if a CartDiscount exists for a given `key`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
+Checks if a CartDiscount exists with the provided `key`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2145,7 +2145,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->carts()->head()`
-Checks if one or more Carts exist for the provided query predicate. Returns a `200 OK` status if any Carts match the query predicate, or a `404 Not Found` otherwise.
+Checks if one or more Carts exist for the provided query predicate. Returns a `200 OK` status if any Carts match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -2201,7 +2201,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->carts()->withId("ID")->head()`
-Checks if a Cart exists for the provided `id`. Returns a `200 OK` status if the Cart exists or a `404 Not Found` otherwise.
+Checks if a Cart exists for the provided `id`. Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -2264,7 +2264,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->carts()->withCustomerId("customerId")->head()`
-Checks if a Cart exists for a Customer. Returns a `200 OK` status if the Cart exists or a `404 Not Found` otherwise.
+Checks if a Cart exists for a Customer. Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -2296,7 +2296,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->carts()->withKey("key")->head()`
-Checks if a Cart exists for the provided `key`. Returns a `200 OK` status if the Cart exists or a `404 Not Found` otherwise.
+Checks if a Cart exists with the provided `key`. Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -2381,7 +2381,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->categories()->head()`
-Checks if a Category exists for on a given Query Predicate. Returns a `200 OK` status if any Categories match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Categories exist for the provided query predicate. Returns a `200 OK` status if any Categories match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -2428,7 +2428,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->categories()->withId("ID")->head()`
-Checks if a Category exists for a given `id`. Returns a `200 OK` status if the Category exists or a `404 Not Found` otherwise.
+Checks if a Category exists with the provided `id`. Returns a `200 OK` status if the Category exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2491,7 +2491,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->categories()->withKey("key")->head()`
-Checks if a Category exists for a given `key`. Returns a `200 OK` status if the Category exists or a `404 Not Found` otherwise.
+Checks if a Category exists with the provided `key`. Returns a `200 OK` status if the Category exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2552,7 +2552,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->channels()->head()`
-Checks if a Channel exists for a given Query Predicate. Returns a `200 OK` status if any Channels match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Channels exist for the provided query predicate. Returns a `200 OK` status if any Channels match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -2595,7 +2595,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->channels()->withId("ID")->head()`
-Checks if a Channel exists for a given `id`. Returns a `200 OK` status if the Channel exists or a `404 Not Found` otherwise.
+Checks if a Channel exists with the provided `id`. Returns a `200 OK` status if the Channel exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2656,7 +2656,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->channels()->withKey("key")->head()`
-Checks if a Channel exists for a given `key`. Returns a `200 OK` status if the Channel exists or a `404 Not Found` otherwise.
+Checks if a Channel exists with the provided `key`. Returns a `200 OK` status if the Channel exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2717,7 +2717,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customObjects()->head()`
-Checks if a CustomObject exists for a given Query Predicate. Returns a `200 OK` status if any CustomObjects match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more CustomObjects exist for the provided query predicate. Returns a `200 OK` status if any CustomObjects match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -2808,7 +2808,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customerGroups()->head()`
-Checks if a CustomerGroup exists for a given Query Predicate. Returns a `200 OK` status if any CustomerGroup match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more CustomerGroups exist for the provided query predicate. Returns a `200 OK` status if any CustomerGroup match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -2851,7 +2851,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customerGroups()->withId("ID")->head()`
-Checks if a CustomerGroup exists for a given `id`. Returns a `200 OK` status if the CustomerGroup exists or a `404 Not Found` otherwise.
+Checks if a CustomerGroup exists with the provided `id`. Returns a `200 OK` status if the CustomerGroup exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2911,7 +2911,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customerGroups()->withKey("key")->head()`
-Checks if a CustomerGroup exists for a given `key`. Returns a `200 OK` status if the CustomerGroup exists or a `404 Not Found` otherwise.
+Checks if a CustomerGroup exists with the provided `key`. Returns a `200 OK` status if the CustomerGroup exists or a `404 Not Found` otherwise.
### Example
```php
@@ -2970,7 +2970,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customers()->head()`
-Checks if a Customer exists for a given Query Predicate. Returns a `200 OK` status if any Customers match the Query Predicate, or a `404 Not Found` otherwise.
+Checks if one or more Customers exist for the provided query predicate. Returns a `200 OK` status if any Customers match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -3017,7 +3017,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customers()->withId("ID")->head()`
-Checks if a Customer exists for a given `id`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
+Checks if a Customer exists with the provided `id`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3130,7 +3130,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->customers()->withKey("key")->head()`
-Checks if a Customer exists for a given `key`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
+Checks if a Customer exists with the provided `key`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3310,7 +3310,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->discountCodes()->head()`
-Checks if a DiscountCode exists for a given Query Predicate. Returns a `200 OK` status if any DiscountCodes match the Query Predicate, or a `404 Not Found` otherwise.
+Checks if one or more DiscountCodes exist for the provided query predicate. Returns a `200 OK` status if any DiscountCodes match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -3356,7 +3356,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->discountCodes()->withId("ID")->head()`
-Checks if a DiscountCode exists for a given `id`. Returns a `200 OK` status if the DiscountCode exists or a `404 Not Found` otherwise.
+Checks if a DiscountCode exists with the provided `id`. Returns a `200 OK` status if the DiscountCode exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3419,7 +3419,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->discountCodes()->withKey("key")->head()`
-Checks if a DiscountCode exists for a given `key`. Returns a `200 OK` status if the DiscountCode exists or a `404 Not Found` otherwise.
+Checks if a DiscountCode exists with the provided `key`. Returns a `200 OK` status if the DiscountCode exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3481,7 +3481,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->extensions()->head()`
-Checks if an Extension exists for a given Query Predicate. Returns a `200 OK` status if any Extensions match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Extensions exist for the provided query predicate. Returns a `200 OK` status if any Extensions match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -3524,7 +3524,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->extensions()->withId("ID")->head()`
-Checks if an Extension exists for a given `id`. Returns a `200 OK` status if the Extension exists or a `404 Not Found` otherwise.
+Checks if an Extension exists with the provided `id`. Returns a `200 OK` status if the Extension exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3584,7 +3584,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->extensions()->withKey("key")->head()`
-Checks if an Extension exists for a given `key`. Returns a `200 OK` status if the Extension exists or a `404 Not Found` otherwise.
+Checks if an Extension exists with the provided `key`. Returns a `200 OK` status if the Extension exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3677,7 +3677,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->businessUnits()->head()`
-Checks if a BusinessUnit exists for a given Query Predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more BusinessUnits exist for the provided query predicate. Returns a `200 OK` status if any BusinessUnits match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -3740,7 +3740,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->businessUnits()->withId("ID")->head()`
-Checks if a BusinessUnit exists for a given `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
+Checks if a BusinessUnit exists with the provided `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3804,7 +3804,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->businessUnits()->withKey("key")->head()`
-Checks if a BusinessUnit exists for a given `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
+Checks if a BusinessUnit exists with the provided `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -3884,7 +3884,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->cartDiscounts()->head()`
-Checks if a CartDiscount exists for a given Query Predicate. Returns a `200 OK` status if any CartDiscounts match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more CartDiscounts exist for the provided query predicate. Returns a `200 OK` status if any CartDiscounts match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -3933,7 +3933,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->cartDiscounts()->withId("ID")->head()`
-Checks if a CartDiscount exists for a given `id`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
+Checks if a CartDiscount exists with the provided `id`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
### Example
```php
@@ -4001,7 +4001,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->cartDiscounts()->withKey("key")->head()`
-Checks if a CartDiscount exists for a given `key`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
+Checks if a CartDiscount exists with the provided `key`. Returns a `200 OK` status if the CartDiscount exists or a `404 Not Found` otherwise.
### Example
```php
@@ -4068,7 +4068,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->carts()->head()`
-Checks if one or more Carts exist for the provided query predicate in a [Store](ctp:api:type:Store). Returns a `200 OK` status if any Carts match the query predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more Carts exist for the provided query predicate in a [Store](ctp:api:type:Store). Returns a `200 OK` status if any Carts match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -4130,7 +4130,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->carts()->withId("ID")->head()`
-Checks if a Cart exists for the provided `id` in a Store. Returns a `200 OK` status if the Cart exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Cart exists for the provided `id` in a Store. Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -4205,7 +4205,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->carts()->withCustomerId("customerId")->head()`
-Checks if one or more Carts exist for a Customer in a [Store](ctp:api:type:Store). Returns a `200 OK` status if the Cart exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more Carts exist for a Customer in a [Store](ctp:api:type:Store). Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -4243,7 +4243,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->carts()->withKey("key")->head()`
-Checks if a Cart exists for the provided `key` in a [Store](ctp:api:type:Store). Returns a `200 OK` status if the Cart exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Cart exists with the provided `key` in a [Store](ctp:api:type:Store). Returns a `200 OK` status if the Cart exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -4338,7 +4338,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->customers()->head()`
-Checks if a Customer exists for a given Query Predicate. Returns a `200 OK` status if any Customers match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more Customers exist for the provided query predicate. Returns a `200 OK` status if any Customers match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -4392,7 +4392,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->customers()->withId("ID")->head()`
-Checks if a Customer exists for a given `id`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
+Checks if a Customer exists with the provided `id`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
### Example
```php
@@ -4522,7 +4522,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->customers()->withKey("key")->head()`
-Checks if a Customer exists for a given `key`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
+Checks if a Customer exists with the provided `key`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
### Example
```php
@@ -4807,7 +4807,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->me()->carts()->head()`
-Checks if a Cart exists for a Store that matches the given Query Predicate, and contains a matching `customerId` or `anonymousId`. Returns a `200 OK` status if any Carts match these conditions, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Cart exists for a Store that matches the given Query Predicate, and contains a matching `customerId` or `anonymousId`. Returns a `200 OK` status if any Carts match these conditions, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
@@ -5007,7 +5007,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->me()->orders()->head()`
-Checks if an Order exists for a given Query Predicate in a Store. Returns a `200 OK` status if successful.
+Checks if one or more Orders exist for the provided query predicate in a Store. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -5090,7 +5090,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->me()->orders()->withId("ID")->head()`
-Checks if an Order exists for a given `id` in a Store. Returns a `200 OK` status if successful.
+Checks if an Order exists with the provided `id` in a Store. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -5251,7 +5251,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->me()->shoppingLists()->withId("ID")->head()`
-Checks if a ShoppingList exists for a given `id` in a Store. Returns a `200 OK` status if successful.
+Checks if a ShoppingList exists with the provided `id` in a Store. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -5348,7 +5348,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->me()->shoppingLists()->withKey("key")->head()`
-Checks if a ShoppingList exists for a given `key` in a Store. Returns a `200 OK` status if successful.
+Checks if a ShoppingList exists with the provided `key` in a Store. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -5459,7 +5459,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->orders()->head()`
-Checks if an Order exists for a given Query Predicate. Returns a `200 OK` status if any Orders match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more Orders exist for the provided query predicate. Returns a `200 OK` status if any Orders match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -5524,7 +5524,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->orders()->withId("ID")->head()`
-Checks if an Order exists for a given `id`. Returns a `200 OK` status if the Order exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if an Order exists with the provided `id`. Returns a `200 OK` status if the Order exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -5593,7 +5593,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->orders()->withOrderNumber("orderNumber")->head()`
-Checks if an Order exists for a given `orderNumber`. Returns a `200 OK` status if the Order exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if an Order exists for a given `orderNumber`. Returns a `200 OK` status if the Order exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -5698,7 +5698,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->productProjections()->withId("ID")->head()`
-Checks if the current or staged representations of a Product exists for a given `id` in the specified [Store](ctp:api:type:Store). Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
+Checks if the current or staged representations of a Product exists with the provided `id` in the specified [Store](ctp:api:type:Store). Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
### Example
```php
@@ -5740,7 +5740,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->productProjections()->withKey("key")->head()`
-Checks if the current or staged representations of a Product exists for a given `key` in the specified [Store](ctp:api:type:Store). Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
+Checks if the current or staged representations of a Product exists with the provided `key` in the specified [Store](ctp:api:type:Store). Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
### Example
```php
@@ -5991,7 +5991,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->quoteRequests()->head()`
-Checks if a QuoteRequest exists for a given Query Predicate. Returns a `200 OK` status if any QuoteRequests match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more QuoteRequests exist for the provided query predicate. Returns a `200 OK` status if any QuoteRequests match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6037,7 +6037,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->quoteRequests()->withId("ID")->head()`
-Checks if a QuoteRequest exists for a given `id`. Returns a `200 OK` status if the QuoteRequest exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a QuoteRequest exists with the provided `id`. Returns a `200 OK` status if the QuoteRequest exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6101,7 +6101,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->quoteRequests()->withKey("key")->head()`
-Checks if a QuoteRequest exists for a given `key`. Returns a `200 OK` status if the QuoteRequest exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a QuoteRequest exists with the provided `key`. Returns a `200 OK` status if the QuoteRequest exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6164,7 +6164,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->quotes()->head()`
-Checks if a Quote exists for a given Query Predicate. Returns a `200 OK` status if any Quotes match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more Quotes exist for the provided query predicate. Returns a `200 OK` status if any Quotes match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6210,7 +6210,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->quotes()->withId("ID")->head()`
-Checks if a Quote exists for a given `id`. Returns a `200 OK` status if the Quote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Quote exists with the provided `id`. Returns a `200 OK` status if the Quote exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6274,7 +6274,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->quotes()->withKey("key")->head()`
-Checks if a Quote exists for a given `key`. Returns a `200 OK` status if the Quote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Quote exists with the provided `key`. Returns a `200 OK` status if the Quote exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6373,7 +6373,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->shoppingLists()->head()`
-Checks if a ShoppingList exists for a given Query Predicate. Returns a `200 OK` status if any ShoppingLists match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more ShoppingLists exist for the provided query predicate. Returns a `200 OK` status if any ShoppingLists match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6422,7 +6422,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->shoppingLists()->withId("ID")->head()`
-Checks if a ShoppingList exists for a given `id`. Returns a `200 OK` status if the ShoppingList exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a ShoppingList exists with the provided `id`. Returns a `200 OK` status if the ShoppingList exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6492,7 +6492,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->shoppingLists()->withKey("key")->head()`
-Checks if a ShoppingList exists for a given `key`. Returns a `200 OK` status if the ShoppingList exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a ShoppingList exists with the provided `key`. Returns a `200 OK` status if the ShoppingList exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6559,7 +6559,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->stagedQuotes()->head()`
-Checks if a StagedQuote exists for a given Query Predicate. Returns a `200 OK` status if any StagedQuotes match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more StagedQuotes exist for the provided query predicate. Returns a `200 OK` status if any StagedQuotes match the query predicate, or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6605,7 +6605,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->stagedQuotes()->withId("ID")->head()`
-Checks if a StagedQuote exists for a given `id`. Returns a `200 OK` status if the StagedQuote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a StagedQuote exists with the provided `id`. Returns a `200 OK` status if the StagedQuote exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6669,7 +6669,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inStoreKeyWithStoreKeyValue("storeKey")->stagedQuotes()->withKey("key")->head()`
-Checks if a StagedQuote exists for a given `key`. Returns a `200 OK` status if the StagedQuote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a StagedQuote exists with the provided `key`. Returns a `200 OK` status if the StagedQuote exists or [Not Found](/../api/errors#404-not-found) otherwise.
### Example
```php
@@ -6731,7 +6731,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inventory()->head()`
-Checks if an InventoryEntry exists for a given Query Predicate. Returns a `200 OK` status if any Inventory Entries match the Query Predicate, a `404 Not Found` otherwise.
+Checks if one or more InventoryEntries exist for the provided query predicate. Returns a `200 OK` status if any Inventory Entries match the Query Predicate, a `404 Not Found` otherwise.
### Example
```php
@@ -6774,7 +6774,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inventory()->withId("ID")->head()`
-Checks if an InventoryEntry exists for a given `id`. Returns a `200 OK` status if the InventoryEntry exists or a `404 Not Found` otherwise.
+Checks if an InventoryEntry exists with the provided `id`. Returns a `200 OK` status if the InventoryEntry exists or a `404 Not Found` otherwise.
### Example
```php
@@ -6834,7 +6834,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->inventory()->withKey("key")->head()`
-Checks if an InventoryEntry exists for a given `key`. Returns a `200 OK` status if the InventoryEntry exists or a `404 Not Found` otherwise.
+Checks if an InventoryEntry exists with the provided `key`. Returns a `200 OK` status if the InventoryEntry exists or a `404 Not Found` otherwise.
### Example
```php
@@ -7011,7 +7011,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->businessUnits()->head()`
-Checks if a BusinessUnit exists for a given Query Predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate and the Customer has access to them, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more BusinessUnits exist for the provided query predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate and the Customer has access to them, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
@@ -7060,7 +7060,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->businessUnits()->withId("ID")->head()`
-Checks if a BusinessUnit exists for a given `id`. Returns a `200 OK` status if the BusinessUnit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a BusinessUnit exists with the provided `id`. Returns a `200 OK` status if the BusinessUnit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -7109,7 +7109,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->businessUnits()->withKey("key")->head()`
-Checks if a BusinessUnit exists for a given `key`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a BusinessUnit exists with the provided `key`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -7201,7 +7201,7 @@ Returns a Cart for a given `id`. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
-- If no Cart exists for a given `id`.
+- If no Cart exists with the provided `id`.
- If the Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope.
@@ -7219,11 +7219,11 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->carts()->withId("ID")->head()`
-Checks if a Cart exists for a given `id`. Returns a `200 OK` status if the Cart exists.
+Checks if a Cart exists with the provided `id`. Returns a `200 OK` status if the Cart exists.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
-- If no Cart exists for a given `id`.
+- If no Cart exists with the provided `id`.
- If the Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope.
@@ -7245,7 +7245,7 @@ Updates the Cart for a given `id`. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
-- If no Cart exists for a given `id`.
+- If no Cart exists with the provided `id`.
- If the Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope.
@@ -7267,7 +7267,7 @@ Deletes the Cart for a given `id`. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
-- If no Cart exists for a given `id`.
+- If no Cart exists with the provided `id`.
- If the Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope.
@@ -7379,7 +7379,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->orders()->head()`
-Checks if an Order exists for a given Query Predicate. Returns a `200 OK` status if successful.
+Checks if one or more Orders exist for the provided query predicate. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -7458,7 +7458,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->orders()->withId("ID")->head()`
-Checks if an Order exists for a given `id`. Returns a `200 OK` status if successful.
+Checks if an Order exists with the provided `id`. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -7561,7 +7561,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->payments()->head()`
-Checks if a [Payment](/projects/me-payments#mypayment) exists for a given Query Predicate. Returns a `200 OK` status if any Payments match the Query Predicate or a `404 Not Found` otherwise.
+Checks if a [Payment](/projects/me-payments#mypayment) exists for the provided query predicate. Returns a `200 OK` status if any Payments match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -7609,7 +7609,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->payments()->withId("ID")->head()`
-Checks if a [Payment](/projects/me-payments#mypayment) exists for a given `id`. Returns a `200 OK` status if the Payment exists or a `404 Not Found` otherwise.
+Checks if a [Payment](/projects/me-payments#mypayment) exists with the provided `id`. Returns a `200 OK` status if the Payment exists or a `404 Not Found` otherwise.
### Example
```php
@@ -7677,7 +7677,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->quoteRequests()->head()`
-Checks if a QuoteRequest exists for a given Query Predicate. Returns a `200 OK` status if any QuoteRequests match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more QuoteRequests exist for the provided query predicate. Returns a `200 OK` status if any QuoteRequests match the query predicate, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
@@ -7724,7 +7724,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->quoteRequests()->withId("ID")->head()`
-Checks if a QuoteRequest exists for a given `id`. Returns a `200 OK` status if the QuoteRequest exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a QuoteRequest exists with the provided `id`. Returns a `200 OK` status if the QuoteRequest exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -7772,7 +7772,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->quoteRequests()->withKey("key")->head()`
-Checks if a QuoteRequest exists for a given `key`. Returns a `200 OK` status if the QuoteRequest exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a QuoteRequest exists with the provided `key`. Returns a `200 OK` status if the QuoteRequest exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -7819,7 +7819,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->quotes()->head()`
-Checks if a Quote exists for a given Query Predicate. Returns a `200 OK` status if any Quotes match the Query Predicate or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if one or more Quotes exist for the provided query predicate. Returns a `200 OK` status if any Quotes match the query predicate, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -7850,7 +7850,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->quotes()->withId("ID")->head()`
-Checks if a Quote exists for a given `id`. Returns a `200 OK` status if the Quote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Quote exists with the provided `id`. Returns a `200 OK` status if the Quote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -7898,7 +7898,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->quotes()->withKey("key")->head()`
-Checks if a Quote exists for a given `key`. Returns a `200 OK` status if the Quote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
+Checks if a Quote exists with the provided `key`. Returns a `200 OK` status if the Quote exists or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
### Example
```php
@@ -8010,7 +8010,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->shoppingLists()->withId("ID")->head()`
-Checks if a ShoppingList exists for a given `id`. Returns a `200 OK` status if successful.
+Checks if a ShoppingList exists with the provided `id`. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -8098,7 +8098,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->me()->shoppingLists()->withKey("key")->head()`
-Checks if a ShoppingList exists for a given `key`. Returns a `200 OK` status if successful.
+Checks if a ShoppingList exists with the provided `key`. Returns a `200 OK` status if successful.
A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
@@ -8196,7 +8196,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->messages()->head()`
-Checks if a Message exists for a given Query Predicate. Returns a `200 OK` status if any Messages match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Messages exist for the provided query predicate. Returns a `200 OK` status if any Messages match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -8225,7 +8225,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->messages()->withId("ID")->head()`
-Checks if a Message exists for a given `id`. Returns a `200 OK` status if the Message exists or a `404 Not Found` otherwise.
+Checks if a Message exists with the provided `id`. Returns a `200 OK` status if the Message exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8254,7 +8254,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->orders()->head()`
-Checks if an Order exists for a given Query Predicate. Returns a `200 OK` status if any Orders match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Orders exist for the provided query predicate. Returns a `200 OK` status if any Orders match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -8315,7 +8315,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->orders()->withId("ID")->head()`
-Checks if an Order exists for a given `id`. Returns a `200 OK` status if the Order exists or a `404 Not Found` otherwise.
+Checks if an Order exists with the provided `id`. Returns a `200 OK` status if the Order exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8376,7 +8376,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->orders()->edits()->head()`
-Checks if an OrderEdit exists for a given Query Predicate. Returns a `200 OK` status if any OrderEdits match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more OrderEdits exist for the provided query predicate. Returns a `200 OK` status if any OrderEdits match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -8425,7 +8425,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->orders()->edits()->withId("ID")->head()`
-Checks if an OrderEdit exists for a given `id`. Returns a `200 OK` status if the OrderEdit exists or a `404 Not Found` otherwise.
+Checks if an OrderEdit exists with the provided `id`. Returns a `200 OK` status if the OrderEdit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8507,7 +8507,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->orders()->edits()->withKey("key")->head()`
-Checks if an OrderEdit exists for a given `key`. Returns a `200 OK` status if the OrderEdit exists or a `404 Not Found` otherwise.
+Checks if an OrderEdit exists with the provided `key`. Returns a `200 OK` status if the OrderEdit exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8709,7 +8709,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->payments()->head()`
-Checks if a Payment exists for a given Query Predicate. Returns a `200 OK` status if any Payments match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Payments exist for the provided query predicate. Returns a `200 OK` status if any Payments match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -8753,7 +8753,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->payments()->withId("ID")->head()`
-Checks if a Payment exists for a given `id`. Returns a `200 OK` status if the Payment exists or a `404 Not Found` otherwise.
+Checks if a Payment exists with the provided `id`. Returns a `200 OK` status if the Payment exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8813,7 +8813,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->payments()->withKey("key")->head()`
-Checks if a Payment exists for a given `key`. Returns a `200 OK` status if the Payment exists or a `404 Not Found` otherwise.
+Checks if a Payment exists with the provided `key`. Returns a `200 OK` status if the Payment exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8872,7 +8872,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productDiscounts()->head()`
-Checks if a ProductDiscount exists for a given Query Predicate. Returns a `200 OK` status if any ProductDiscounts match the Query Predicate, or a `404 Not Found` otherwise.
+Checks if one or more ProductDiscounts exist for the provided query predicate. Returns a `200 OK` status if any ProductDiscounts match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -8915,7 +8915,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productDiscounts()->withId("ID")->head()`
-Checks if a ProductDiscount exists for a given `id`. Returns a `200 OK` status if the ProductDiscount exists or a `404 Not Found` otherwise.
+Checks if a ProductDiscount exists with the provided `id`. Returns a `200 OK` status if the ProductDiscount exists or a `404 Not Found` otherwise.
### Example
```php
@@ -8975,7 +8975,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productDiscounts()->withKey("key")->head()`
-Checks if a ProductDiscount exists for a given `key`. Returns a `200 OK` status if the ProductDiscount exists or a `404 Not Found` otherwise.
+Checks if a ProductDiscount exists with the provided `key`. Returns a `200 OK` status if the ProductDiscount exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9056,7 +9056,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productProjections()->head()`
-Checks if the current or staged representation of a Product exists for a given Query Predicate. Returns a `200 OK` status if any ProductProjections match the Query Predicate or a `404 Not Found` otherwise.
+Checks if the current or staged representation of a Product exists for the provided query predicate. Returns a `200 OK` status if any ProductProjections match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -9086,7 +9086,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productProjections()->withId("ID")->head()`
-Checks if the current or staged representation of a Product exists for a given `id`. Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
+Checks if the current or staged representation of a Product exists with the provided `id`. Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9119,7 +9119,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productProjections()->withKey("key")->head()`
-Checks if the current or staged representation of a Product exists for a given `key`. Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
+Checks if the current or staged representation of a Product exists with the provided `key`. Returns a `200 OK` status if the ProductProjection exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9199,7 +9199,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productSelections()->head()`
-Checks if a ProductSelection exists for a given Query Predicate. Returns a `200 OK` status if any ProductSelections match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more ProductSelections exist for the provided query predicate. Returns a `200 OK` status if any ProductSelections match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -9242,7 +9242,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productSelections()->withId("ID")->head()`
-Checks if a ProductSelection exists for a given `id`. Returns a `200 OK` status if the ProductSelection exists or a `404 Not Found` otherwise.
+Checks if a ProductSelection exists with the provided `id`. Returns a `200 OK` status if the ProductSelection exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9318,7 +9318,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productSelections()->withKey("key")->head()`
-Checks if a ProductSelection exists for a given `key`. Returns a `200 OK` status if the ProductSelection exists or a `404 Not Found` otherwise.
+Checks if a ProductSelection exists with the provided `key`. Returns a `200 OK` status if the ProductSelection exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9393,7 +9393,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productTailoring()->head()`
-Checks if a ProductTailoring exists for a given Query Predicate. Returns a `200 OK` status if any ProductTailoring match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more ProductTailorings exist for the provided query predicate. Returns a `200 OK` status if any ProductTailoring match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -9528,7 +9528,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productTypes()->head()`
-Checks if a ProductType exists for a given Query Predicate. Returns a `200 OK` status if any ProductTypes match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more ProductTypes exist for the provided query predicate. Returns a `200 OK` status if any ProductTypes match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -9571,7 +9571,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productTypes()->withId("ID")->head()`
-Checks if a ProductType exists for a given `id`. Returns a `200 OK` status if the ProductType exists or a `404 Not Found` otherwise.
+Checks if a ProductType exists with the provided `id`. Returns a `200 OK` status if the ProductType exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9631,7 +9631,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->productTypes()->withKey("key")->head()`
-Checks if a ProductType exists for a given `key`. Returns a `200 OK` status if the ProductType exists or a `404 Not Found` otherwise.
+Checks if a ProductType exists with the provided `key`. Returns a `200 OK` status if the ProductType exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9690,7 +9690,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->products()->head()`
-Checks if a Product exists for a given Query Predicate. Returns a `200 OK` status if any Products match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Products exist for the provided query predicate. Returns a `200 OK` status if any Products match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -9736,7 +9736,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->products()->withId("ID")->head()`
-Checks if a Product exists for a given `id`. Returns a `200 OK` status if the Product exists or a `404 Not Found` otherwise.
+Checks if a Product exists with the provided `id`. Returns a `200 OK` status if the Product exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9841,7 +9841,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->products()->withKey("key")->head()`
-Checks if a Product exists for a given `key`. Returns a `200 OK` status if the Product exists or a `404 Not Found` otherwise.
+Checks if a Product exists with the provided `key`. Returns a `200 OK` status if the Product exists or a `404 Not Found` otherwise.
### Example
```php
@@ -9934,7 +9934,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->quoteRequests()->head()`
-Checks if a QuoteRequest exists for a given Query Predicate. Returns a `200 OK` status if any QuoteRequests match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more QuoteRequests exist for the provided query predicate. Returns a `200 OK` status if any QuoteRequests match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -9977,7 +9977,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->quoteRequests()->withId("ID")->head()`
-Checks if a QuoteRequest exists for a given `id`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
+Checks if a QuoteRequest exists with the provided `id`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10037,7 +10037,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->quoteRequests()->withKey("key")->head()`
-Checks if a QuoteRequest exists for a given `key`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
+Checks if a QuoteRequest exists with the provided `key`. Returns a `200 OK` status if the QuoteRequest exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10096,7 +10096,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->quotes()->head()`
-Checks if a Quote exists for a given Query Predicate. Returns a `200 OK` status if any Quotes match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Quotes exist for the provided query predicate. Returns a `200 OK` status if any Quotes match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -10139,7 +10139,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->quotes()->withId("ID")->head()`
-Checks if a Quote exists for a given `id`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
+Checks if a Quote exists with the provided `id`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10199,7 +10199,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->quotes()->withKey("key")->head()`
-Checks if a Quote exists for a given `key`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
+Checks if a Quote exists with the provided `key`. Returns a `200 OK` status if the Quote exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10258,7 +10258,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->reviews()->head()`
-Checks if a Review exists for a given Query Predicate. Returns a `200 OK` status if any Reviews match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Reviews exist for the provided query predicate. Returns a `200 OK` status if any Reviews match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -10301,7 +10301,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->reviews()->withId("ID")->head()`
-Checks if a Review exists for a given `id`. Returns a `200 OK` status if the Review exists or a `404 Not Found` otherwise.
+Checks if a Review exists with the provided `id`. Returns a `200 OK` status if the Review exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10361,7 +10361,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->reviews()->withKey("key")->head()`
-Checks if a Review exists for a given `key`. Returns a `200 OK` status if the Review exists or a `404 Not Found` otherwise.
+Checks if a Review exists with the provided `key`. Returns a `200 OK` status if the Review exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10420,7 +10420,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->shippingMethods()->head()`
-Checks if a ShippingMethod exists for a given Query Predicate. Returns a `200 OK` status if any ShippingMethods match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more ShippingMethods exist for the provided query predicate. Returns a `200 OK` status if any ShippingMethods match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -10463,7 +10463,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->shippingMethods()->withId("ID")->head()`
-Checks if a ShippingMethod exists for a given `id`. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.
+Checks if a ShippingMethod exists with the provided `id`. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10523,7 +10523,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->shippingMethods()->withKey("key")->head()`
-Checks if a ShippingMethod exists for a given `key`. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.
+Checks if a ShippingMethod exists with the provided `key`. Returns a `200 OK` status if the ShippingMethod exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10720,7 +10720,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->shoppingLists()->head()`
-Checks if a ShoppingList exists for a given Query Predicate. Returns a `200 OK` status if any ShoppingLists match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more ShoppingLists exist for the provided query predicate. Returns a `200 OK` status if any ShoppingLists match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -10763,7 +10763,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->shoppingLists()->withId("ID")->head()`
-Checks if a ShoppingList exists for a given `id`. Returns a `200 OK` status if the ShoppingList exists or a `404 Not Found` otherwise.
+Checks if a ShoppingList exists with the provided `id`. Returns a `200 OK` status if the ShoppingList exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10823,7 +10823,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->shoppingLists()->withKey("key")->head()`
-Checks if a ShoppingList exists for a given `key`. Returns a `200 OK` status if the ShoppingList exists or a `404 Not Found` otherwise.
+Checks if a ShoppingList exists with the provided `key`. Returns a `200 OK` status if the ShoppingList exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10882,7 +10882,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->stagedQuotes()->head()`
-Checks if a StagedQuote exists for a given Query Predicate. Returns a `200 OK` status if any StagedQuotes match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more StagedQuotes exist for the provided query predicate. Returns a `200 OK` status if any StagedQuotes match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -10925,7 +10925,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->stagedQuotes()->withId("ID")->head()`
-Checks if a StagedQuote exists for a given `id`. Returns a `200 OK` status if the StagedQuote exists or a `404 Not Found` otherwise.
+Checks if a StagedQuote exists with the provided `id`. Returns a `200 OK` status if the StagedQuote exists or a `404 Not Found` otherwise.
### Example
```php
@@ -10985,7 +10985,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->stagedQuotes()->withKey("key")->head()`
-Checks if a StagedQuote exists for a given `key`. Returns a `200 OK` status if the StagedQuote exists or a `404 Not Found` otherwise.
+Checks if a StagedQuote exists with the provided `key`. Returns a `200 OK` status if the StagedQuote exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11044,7 +11044,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->standalonePrices()->head()`
-Checks if a StandalonePrice exists for a given Query Predicate. Returns a `200 OK` status if any StandalonePrices match the Query Predicate, or a `404 Not Found` otherwise.
+Checks if one or more StandalonePrices exist for the provided query predicate. Returns a `200 OK` status if any StandalonePrices match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -11091,7 +11091,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->standalonePrices()->withId("ID")->head()`
-Checks if a StandalonePrice exists for a given `id`. Returns a `200 OK` status if the StandalonePrice exists or a `404 Not Found` otherwise.
+Checks if a StandalonePrice exists with the provided `id`. Returns a `200 OK` status if the StandalonePrice exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11152,7 +11152,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->standalonePrices()->withKey("key")->head()`
-Checks if a StandalonePrice exists for a given `key`. Returns a `200 OK` status if the StandalonePrice exists or a `404 Not Found` otherwise.
+Checks if a StandalonePrice exists with the provided `key`. Returns a `200 OK` status if the StandalonePrice exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11212,7 +11212,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->states()->head()`
-Checks if a State exists for a given Query Predicate. Returns a `200 OK` status if any States match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more States exist for the provided query predicate. Returns a `200 OK` status if any States match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -11255,7 +11255,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->states()->withId("ID")->head()`
-Checks if a State exists for a given `id`. Returns a `200 OK` status if the State exists or a `404 Not Found` otherwise.
+Checks if a State exists with the provided `id`. Returns a `200 OK` status if the State exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11315,7 +11315,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->states()->withKey("key")->head()`
-Checks if a State exists for a given `key`. Returns a `200 OK` status if the State exists or a `404 Not Found` otherwise.
+Checks if a State exists with the provided `key`. Returns a `200 OK` status if the State exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11374,7 +11374,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->stores()->head()`
-Checks if a Store exists for a given Query Predicate. Returns a `200 OK` status if any Stores match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Stores exist for the provided query predicate. Returns a `200 OK` status if any Stores match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -11417,7 +11417,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->stores()->withId("ID")->head()`
-Checks if a Store exists for a given `id`. Returns a `200 OK` status if the Store exists or a `404 Not Found` otherwise.
+Checks if a Store exists with the provided `id`. Returns a `200 OK` status if the Store exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11477,7 +11477,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->stores()->withKey("key")->head()`
-Checks if a Store exists for a given `key`. Returns a `200 OK` status if the Store exists or a `404 Not Found` otherwise.
+Checks if a Store exists with the provided `key`. Returns a `200 OK` status if the Store exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11536,7 +11536,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->subscriptions()->head()`
-Checks if a Subscription exists for a given Query Predicate. Returns a `200 OK` status if any Subscriptions match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Subscriptions exist for the provided query predicate. Returns a `200 OK` status if any Subscriptions match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -11580,7 +11580,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->subscriptions()->withId("ID")->head()`
-Checks if a Subscription exists for a given `id`. Returns a `200 OK` status if the Subscription exists or a `404 Not Found` otherwise.
+Checks if a Subscription exists with the provided `id`. Returns a `200 OK` status if the Subscription exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11657,7 +11657,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->subscriptions()->withKey("key")->head()`
-Checks if a Subscription exists for a given `key`. Returns a `200 OK` status if the Subscription exists or a `404 Not Found` otherwise.
+Checks if a Subscription exists with the provided `key`. Returns a `200 OK` status if the Subscription exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11716,7 +11716,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->taxCategories()->head()`
-Checks if a TaxCategory exists for a given Query Predicate. Returns a `200 OK` status if any TaxCategories match the Query Predicate, or a `404 Not Found` otherwise.
+Checks if one or more Tax Categories exist for the provided query predicate. Returns a `200 OK` status if any TaxCategories match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -11759,7 +11759,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->taxCategories()->withId("ID")->head()`
-Checks if a TaxCategory exists for a given `id`. Returns a `200 OK` status if the TaxCategory exists or a `404 Not Found` otherwise.
+Checks if a TaxCategory exists with the provided `id`. Returns a `200 OK` status if the TaxCategory exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11819,7 +11819,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->taxCategories()->withKey("key")->head()`
-Checks if a TaxCategory exists for a given `key`. Returns a `200 OK` status if the Tax Category exists or a `404 Not Found` otherwise.
+Checks if a TaxCategory exists with the provided `key`. Returns a `200 OK` status if the Tax Category exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11878,7 +11878,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->types()->head()`
-Checks if a Type exists for a given Query Predicate. Returns a `200 OK` status if any Types match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Types exist for the provided query predicate. Returns a `200 OK` status if any Types match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -11921,7 +11921,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->types()->withId("ID")->head()`
-Checks if a Type exists for a given `id`. Returns a `200 OK` status if the Type exists or a `404 Not Found` otherwise.
+Checks if a Type exists with the provided `id`. Returns a `200 OK` status if the Type exists or a `404 Not Found` otherwise.
### Example
```php
@@ -11981,7 +11981,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->types()->withKey("key")->head()`
-Checks if a Type exists for a given `key`. Returns a `200 OK` status if the Type exists or a `404 Not Found` otherwise.
+Checks if a Type exists with the provided `key`. Returns a `200 OK` status if the Type exists or a `404 Not Found` otherwise.
### Example
```php
@@ -12040,7 +12040,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->zones()->head()`
-Checks if a Zone exists for a given Query Predicate. Returns a `200 OK` status if any Zones match the Query Predicate or a `404 Not Found` otherwise.
+Checks if one or more Zones exist for the provided query predicate. Returns a `200 OK` status if any Zones match the query predicate, or a `404 Not Found` otherwise.
### Example
```php
@@ -12083,7 +12083,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->zones()->withId("ID")->head()`
-Checks if a Zone exists for a given `id`. Returns a `200 OK` status if the Zone exists or a `404 Not Found` otherwise.
+Checks if a Zone exists with the provided `id`. Returns a `200 OK` status if the Zone exists or a `404 Not Found` otherwise.
### Example
```php
@@ -12143,7 +12143,7 @@ $request = $builder
```
## `withProjectKey("projectKey")->zones()->withKey("key")->head()`
-Checks if a Zone exists for a given `key`. Returns a `200 OK` status if the Zone exists or a `404 Not Found` otherwise.
+Checks if a Zone exists with the provided `key`. Returns a `200 OK` status if the Zone exists or a `404 Not Found` otherwise.
### Example
```php
diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitAction.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitAction.php
index 511f05223c3..2a867afa8a5 100644
--- a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitAction.php
+++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitAction.php
@@ -16,7 +16,9 @@ interface BusinessUnitChangeParentUnitAction extends BusinessUnitUpdateAction
public const FIELD_PARENT_UNIT = 'parentUnit';
/**
- * inheritedAssociates and inheritedStores field values will be eventually consistent.inheritedAssociates and inheritedStores field values will be eventually consistent.inheritedAssociates and inheritedStores field values will be eventually consistent.
If unitType="Company", the Business Unit storeMode, associateMode, and approvalRuleMode field values must be Explicit.
New parent unit for the Business Unit, if unitType="Division".
New type of the Business Unit.
+ *If unitType="Company", the Business Unit storeMode, associateMode, and approvalRuleMode field values must be Explicit.
New parent unit for the Business Unit, if unitType="Division".
New type of the Business Unit.
+ *If unitType="Company", the Business Unit storeMode, associateMode, and approvalRuleMode field values must be Explicit.
New parent unit for the Business Unit, if unitType="Division".
ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- *It is automatically set if the Customer referenced in customerId belongs to a Customer Group.
- * It can also be set explicitly when no customerId is present.
You can set either a customerId or a customerGroup.
+ * If the Customer referenced in customerId belongs to a Customer Group then customerGroup is set automatically.
ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- *It is automatically set if the Customer referenced in customerId belongs to a Customer Group.
- * It can also be set explicitly when no customerId is present.
You can set either a customerId or a customerGroup.
+ * If the Customer referenced in customerId belongs to a Customer Group then customerGroup is set automatically.
ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- *It is automatically set if the Customer referenced in customerId belongs to a Customer Group.
- * It can also be set explicitly when no customerId is present.
You can set either a customerId or a customerGroup.
+ * If the Customer referenced in customerId belongs to a Customer Group then customerGroup is set automatically.
"Associate '$idOfAssociate' has no rights to $action in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action for customer '$idOfCustomer' in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action for customer '$idOfCustomer' in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredViewMyPermission' or '$requiredViewOthersPermission'.""Associate '$idOfAssociate' has no rights to $action in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action for customer '$idOfCustomer' in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action for customer '$idOfCustomer' in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredViewMyPermission' or '$requiredViewOthersPermission'.""Associate '$idOfAssociate' has no rights to $action in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action for customer '$idOfCustomer' in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action for customer '$idOfCustomer' in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredPermission'.""Associate '$idOfAssociate' has no rights to $action in business-unit '$idOrKeyOfBusinessUnit'. Needs '$requiredViewMyPermission' or '$requiredViewOthersPermission'."The type of resource targeted by the Event.
+ * + + * @return null|string + */ + public function getResourceType(); + + /** + *The type of Event that has occurred.
+ * + + * @return null|string + */ + public function getType(); + + /** + *An object containing details related to the Event.
+ * + + * @return null|mixed + */ + public function getData(); + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?string $notificationType + */ + public function setNotificationType(?string $notificationType): void; + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void; + + /** + * @param ?string $type + */ + public function setType(?string $type): void; + + /** + * @param ?JsonObject $data + */ + public function setData(?JsonObject $data): void; + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void; +} diff --git a/lib/commercetools-api/src/Models/Event/BaseEventBuilder.php b/lib/commercetools-api/src/Models/Event/BaseEventBuilder.php new file mode 100644 index 00000000000..d86a51359d9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/BaseEventBuilder.php @@ -0,0 +1,207 @@ + + */ +final class BaseEventBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?string + */ + private $notificationType; + + /** + + * @var ?string + */ + private $resourceType; + + /** + + * @var ?string + */ + private $type; + + /** + + * @var ?JsonObject + */ + private $data; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + *Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + *The type of resource targeted by the Event.
+ * + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + + * @return null|string + */ + public function getType() + { + return $this->type; + } + + /** + *An object containing details related to the Event.
+ * + + * @return null|JsonObject + */ + public function getData() + { + return $this->data; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $notificationType + * @return $this + */ + public function withNotificationType(?string $notificationType) + { + $this->notificationType = $notificationType; + + return $this; + } + + /** + * @param ?string $resourceType + * @return $this + */ + public function withResourceType(?string $resourceType) + { + $this->resourceType = $resourceType; + + return $this; + } + + /** + * @param ?string $type + * @return $this + */ + public function withType(?string $type) + { + $this->type = $type; + + return $this; + } + + /** + * @param ?JsonObject $data + * @return $this + */ + public function withData(?JsonObject $data) + { + $this->data = $data; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + + public function build(): BaseEvent + { + return new BaseEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->type, + $this->data, + $this->createdAt + ); + } + + public static function of(): BaseEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/BaseEventCollection.php b/lib/commercetools-api/src/Models/Event/BaseEventCollection.php new file mode 100644 index 00000000000..5d2ab6228b0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/BaseEventCollection.php @@ -0,0 +1,56 @@ + + * @method BaseEvent current() + * @method BaseEvent end() + * @method BaseEvent at($offset) + */ +class BaseEventCollection extends MapperSequence +{ + /** + * @psalm-assert BaseEvent $value + * @psalm-param BaseEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return BaseEventCollection + */ + public function add($value) + { + if (!$value instanceof BaseEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BaseEvent + */ + protected function mapper() + { + return function (?int $index): ?BaseEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BaseEvent $data */ + $data = BaseEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/BaseEventModel.php b/lib/commercetools-api/src/Models/Event/BaseEventModel.php new file mode 100644 index 00000000000..4cc270eefe9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/BaseEventModel.php @@ -0,0 +1,260 @@ +id = $id; + $this->notificationType = $notificationType; + $this->resourceType = $resourceType; + $this->type = $type; + $this->data = $data; + $this->createdAt = $createdAt; + } + + /** + *Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + *The type of resource targeted by the Event.
+ * + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *An object containing details related to the Event.
+ * + * + * @return null|mixed + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|arrayDate and time (UTC) the Event 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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?string $notificationType + */ + public function setNotificationType(?string $notificationType): void + { + $this->notificationType = $notificationType; + } + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void + { + $this->resourceType = $resourceType; + } + + /** + * @param ?string $type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * @param ?JsonObject $data + */ + public function setData(?JsonObject $data): void + { + $this->data = $data; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[BaseEvent::FIELD_CREATED_AT]) && $data[BaseEvent::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[BaseEvent::FIELD_CREATED_AT] = $data[BaseEvent::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Event/Event.php b/lib/commercetools-api/src/Models/Event/Event.php new file mode 100644 index 00000000000..a8a446ddbc0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/Event.php @@ -0,0 +1,81 @@ +Unique identifier of the Event. + * + + * @return null|string + */ + public function getId(); + + /** + + * @return null|string + */ + public function getNotificationType(); + + /** + *The type of resource targeted by the Event.
+ * + + * @return null|string + */ + public function getResourceType(); + + /** + *The type of Event that has occurred.
+ * + + * @return null|string + */ + public function getType(); + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?string $notificationType + */ + public function setNotificationType(?string $notificationType): void; + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void; + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void; +} diff --git a/lib/commercetools-api/src/Models/Event/EventBuilder.php b/lib/commercetools-api/src/Models/Event/EventBuilder.php new file mode 100644 index 00000000000..133b800f456 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/EventBuilder.php @@ -0,0 +1,149 @@ + + */ +final class EventBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?string + */ + private $notificationType; + + /** + + * @var ?string + */ + private $resourceType; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + *Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + *The type of resource targeted by the Event.
+ * + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $notificationType + * @return $this + */ + public function withNotificationType(?string $notificationType) + { + $this->notificationType = $notificationType; + + return $this; + } + + /** + * @param ?string $resourceType + * @return $this + */ + public function withResourceType(?string $resourceType) + { + $this->resourceType = $resourceType; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + + public function build(): Event + { + return new EventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt + ); + } + + public static function of(): EventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/EventCollection.php b/lib/commercetools-api/src/Models/Event/EventCollection.php new file mode 100644 index 00000000000..ebf4a98fa7b --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/EventCollection.php @@ -0,0 +1,60 @@ + + * @psalm-method T current() + * @psalm-method T end() + * @psalm-method T at($offset) + * @method Event current() + * @method Event end() + * @method Event at($offset) + */ +class EventCollection extends MapperSequence +{ + /** + * @psalm-assert T $value + * @psalm-param T|stdClass $value + * @throws InvalidArgumentException + * + * @return EventCollection + */ + public function add($value) + { + if (!$value instanceof Event) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?T + */ + protected function mapper() + { + return function (?int $index): ?Event { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var T $data */ + $data = EventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/EventModel.php b/lib/commercetools-api/src/Models/Event/EventModel.php new file mode 100644 index 00000000000..783b06a2b62 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/EventModel.php @@ -0,0 +1,256 @@ + > + * + */ + private static $discriminatorClasses = [ + 'ImportContainerCreated' => ImportContainerCreatedEventModel::class, + 'ImportContainerDeleted' => ImportContainerDeletedEventModel::class, + 'ImportOperationRejected' => ImportOperationRejectedEventModel::class, + 'ImportUnresolved' => ImportUnresolvedEventModel::class, + 'ImportValidationFailed' => ImportValidationFailedEventModel::class, + 'ImportWaitForMasterVariant' => ImportWaitForMasterVariantEventModel::class, + ]; + + /** + * @psalm-suppress MissingParamType + */ + public function __construct( + ?string $id = null, + ?string $notificationType = null, + ?string $resourceType = null, + ?DateTimeImmutable $createdAt = null, + ?string $type = null + ) { + $this->id = $id; + $this->notificationType = $notificationType; + $this->resourceType = $resourceType; + $this->createdAt = $createdAt; + $this->type = $type; + } + + /** + *Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + *The type of resource targeted by the Event.
+ * + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?string $notificationType + */ + public function setNotificationType(?string $notificationType): void + { + $this->notificationType = $notificationType; + } + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void + { + $this->resourceType = $resourceType; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[Event::FIELD_CREATED_AT]) && $data[Event::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[Event::FIELD_CREATED_AT] = $data[Event::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } + + /** + * @psalm-param stdClass|arrayUnique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *An object containing details of the created Import Container.
+ * + + * @return null|ImportContainerCreatedEventData + */ + public function getData() + { + return $this->data instanceof ImportContainerCreatedEventDataBuilder ? $this->data->build() : $this->data; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $notificationType + * @return $this + */ + public function withNotificationType(?string $notificationType) + { + $this->notificationType = $notificationType; + + return $this; + } + + /** + * @param ?string $resourceType + * @return $this + */ + public function withResourceType(?string $resourceType) + { + $this->resourceType = $resourceType; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?ImportContainerCreatedEventData $data + * @return $this + */ + public function withData(?ImportContainerCreatedEventData $data) + { + $this->data = $data; + + return $this; + } + + /** + * @deprecated use withData() instead + * @return $this + */ + public function withDataBuilder(?ImportContainerCreatedEventDataBuilder $data) + { + $this->data = $data; + + return $this; + } + + public function build(): ImportContainerCreatedEvent + { + return new ImportContainerCreatedEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt, + $this->data instanceof ImportContainerCreatedEventDataBuilder ? $this->data->build() : $this->data + ); + } + + public static function of(): ImportContainerCreatedEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventCollection.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventCollection.php new file mode 100644 index 00000000000..55d71d029e5 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventCollection.php @@ -0,0 +1,56 @@ + + * @method ImportContainerCreatedEvent current() + * @method ImportContainerCreatedEvent end() + * @method ImportContainerCreatedEvent at($offset) + */ +class ImportContainerCreatedEventCollection extends EventCollection +{ + /** + * @psalm-assert ImportContainerCreatedEvent $value + * @psalm-param ImportContainerCreatedEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportContainerCreatedEventCollection + */ + public function add($value) + { + if (!$value instanceof ImportContainerCreatedEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportContainerCreatedEvent + */ + protected function mapper() + { + return function (?int $index): ?ImportContainerCreatedEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportContainerCreatedEvent $data */ + $data = ImportContainerCreatedEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventData.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventData.php new file mode 100644 index 00000000000..9c060fc6f83 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventData.php @@ -0,0 +1,73 @@ +Thekey of the created Import Container.
+ *
+
+ * @return null|string
+ */
+ public function getKey();
+
+ /**
+ * The version of the created Import Container.
Date and time (UTC) the Import Container was created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt(); + + /** + *Date and time (UTC) the Import Container was last updated.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void; + + /** + * @param ?DateTimeImmutable $lastModifiedAt + */ + public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataBuilder.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataBuilder.php new file mode 100644 index 00000000000..91b41a344d3 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataBuilder.php @@ -0,0 +1,151 @@ + + */ +final class ImportContainerCreatedEventDataBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var ?DateTimeImmutable + */ + private $lastModifiedAt; + + /** + *The key of the created Import Container.
The version of the created Import Container.
Date and time (UTC) the Import Container was created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Date and time (UTC) the Import Container was last updated.
+ * + + * @return null|DateTimeImmutable + */ + public function getLastModifiedAt() + { + return $this->lastModifiedAt; + } + + /** + * @param ?string $key + * @return $this + */ + public function withKey(?string $key) + { + $this->key = $key; + + 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; + } + + + public function build(): ImportContainerCreatedEventData + { + return new ImportContainerCreatedEventDataModel( + $this->key, + $this->version, + $this->createdAt, + $this->lastModifiedAt + ); + } + + public static function of(): ImportContainerCreatedEventDataBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataCollection.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataCollection.php new file mode 100644 index 00000000000..fcb3e9f131c --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataCollection.php @@ -0,0 +1,56 @@ + + * @method ImportContainerCreatedEventData current() + * @method ImportContainerCreatedEventData end() + * @method ImportContainerCreatedEventData at($offset) + */ +class ImportContainerCreatedEventDataCollection extends MapperSequence +{ + /** + * @psalm-assert ImportContainerCreatedEventData $value + * @psalm-param ImportContainerCreatedEventData|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportContainerCreatedEventDataCollection + */ + public function add($value) + { + if (!$value instanceof ImportContainerCreatedEventData) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportContainerCreatedEventData + */ + protected function mapper() + { + return function (?int $index): ?ImportContainerCreatedEventData { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportContainerCreatedEventData $data */ + $data = ImportContainerCreatedEventDataModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataModel.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataModel.php new file mode 100644 index 00000000000..2023db94445 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventDataModel.php @@ -0,0 +1,198 @@ +key = $key; + $this->version = $version; + $this->createdAt = $createdAt; + $this->lastModifiedAt = $lastModifiedAt; + } + + /** + *The key of the created Import Container.
The version of the created Import Container.
Date and time (UTC) the Import Container was created.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Import Container was last updated.
+ * + * + * @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; + } + + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * @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; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[ImportContainerCreatedEventData::FIELD_CREATED_AT]) && $data[ImportContainerCreatedEventData::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[ImportContainerCreatedEventData::FIELD_CREATED_AT] = $data[ImportContainerCreatedEventData::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + + if (isset($data[ImportContainerCreatedEventData::FIELD_LAST_MODIFIED_AT]) && $data[ImportContainerCreatedEventData::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) { + $data[ImportContainerCreatedEventData::FIELD_LAST_MODIFIED_AT] = $data[ImportContainerCreatedEventData::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventModel.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventModel.php new file mode 100644 index 00000000000..55436fd2432 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventModel.php @@ -0,0 +1,252 @@ +id = $id; + $this->notificationType = $notificationType; + $this->resourceType = $resourceType; + $this->createdAt = $createdAt; + $this->data = $data; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + /** + *An object containing details of the created Import Container.
+ * + * + * @return null|ImportContainerCreatedEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|arrayUnique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *An object containing details of the deleted Import Container.
+ * + + * @return null|ImportContainerDeletedEventData + */ + public function getData() + { + return $this->data instanceof ImportContainerDeletedEventDataBuilder ? $this->data->build() : $this->data; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $notificationType + * @return $this + */ + public function withNotificationType(?string $notificationType) + { + $this->notificationType = $notificationType; + + return $this; + } + + /** + * @param ?string $resourceType + * @return $this + */ + public function withResourceType(?string $resourceType) + { + $this->resourceType = $resourceType; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + /** + * @param ?ImportContainerDeletedEventData $data + * @return $this + */ + public function withData(?ImportContainerDeletedEventData $data) + { + $this->data = $data; + + return $this; + } + + /** + * @deprecated use withData() instead + * @return $this + */ + public function withDataBuilder(?ImportContainerDeletedEventDataBuilder $data) + { + $this->data = $data; + + return $this; + } + + public function build(): ImportContainerDeletedEvent + { + return new ImportContainerDeletedEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt, + $this->data instanceof ImportContainerDeletedEventDataBuilder ? $this->data->build() : $this->data + ); + } + + public static function of(): ImportContainerDeletedEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventCollection.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventCollection.php new file mode 100644 index 00000000000..92f02f9acae --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventCollection.php @@ -0,0 +1,56 @@ + + * @method ImportContainerDeletedEvent current() + * @method ImportContainerDeletedEvent end() + * @method ImportContainerDeletedEvent at($offset) + */ +class ImportContainerDeletedEventCollection extends EventCollection +{ + /** + * @psalm-assert ImportContainerDeletedEvent $value + * @psalm-param ImportContainerDeletedEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportContainerDeletedEventCollection + */ + public function add($value) + { + if (!$value instanceof ImportContainerDeletedEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportContainerDeletedEvent + */ + protected function mapper() + { + return function (?int $index): ?ImportContainerDeletedEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportContainerDeletedEvent $data */ + $data = ImportContainerDeletedEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventData.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventData.php new file mode 100644 index 00000000000..fb19d55fee6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventData.php @@ -0,0 +1,44 @@ +Thekey of the deleted Import Container.
+ *
+
+ * @return null|string
+ */
+ public function getKey();
+
+ /**
+ * The version of the deleted Import Container.
The key of the deleted Import Container.
The version of the deleted Import Container.
The key of the deleted Import Container.
The version of the deleted Import Container.
Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + /** + *An object containing details of the deleted Import Container.
+ * + * + * @return null|ImportContainerDeletedEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|arrayrejected state.
+ *
+
+ * @return null|ImportOperationRejectedEventData
+ */
+ public function getData();
+
+ /**
+ * @param ?string $resourceType
+ */
+ public function setResourceType(?string $resourceType): void;
+
+ /**
+ * @param ?ImportOperationRejectedEventData $data
+ */
+ public function setData(?ImportOperationRejectedEventData $data): void;
+}
diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventBuilder.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventBuilder.php
new file mode 100644
index 00000000000..b5afda1ec23
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventBuilder.php
@@ -0,0 +1,186 @@
+
+ */
+final class ImportOperationRejectedEventBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $id;
+
+ /**
+
+ * @var ?string
+ */
+ private $notificationType;
+
+ /**
+
+ * @var ?string
+ */
+ private $resourceType;
+
+ /**
+
+ * @var ?DateTimeImmutable
+ */
+ private $createdAt;
+
+ /**
+
+ * @var null|ImportOperationRejectedEventData|ImportOperationRejectedEventDataBuilder
+ */
+ private $data;
+
+ /**
+ * Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *An object containing details of the Import Operation with the rejected state.
id of the Import Operation with the rejected state.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * @param ?string $id
+ */
+ public function setId(?string $id): void;
+}
diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataBuilder.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataBuilder.php
new file mode 100644
index 00000000000..bfde4f2ebd2
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataBuilder.php
@@ -0,0 +1,63 @@
+
+ */
+final class ImportOperationRejectedEventDataBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $id;
+
+ /**
+ * The id of the Import Operation with the rejected state.
The id of the Import Operation with the rejected state.
Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + /** + *An object containing details of the Import Operation with the rejected state.
unresolved state.
+ *
+
+ * @return null|ImportUnresolvedEventData
+ */
+ public function getData();
+
+ /**
+ * @param ?string $resourceType
+ */
+ public function setResourceType(?string $resourceType): void;
+
+ /**
+ * @param ?ImportUnresolvedEventData $data
+ */
+ public function setData(?ImportUnresolvedEventData $data): void;
+}
diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventBuilder.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventBuilder.php
new file mode 100644
index 00000000000..51e38af6f19
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventBuilder.php
@@ -0,0 +1,186 @@
+
+ */
+final class ImportUnresolvedEventBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $id;
+
+ /**
+
+ * @var ?string
+ */
+ private $notificationType;
+
+ /**
+
+ * @var ?string
+ */
+ private $resourceType;
+
+ /**
+
+ * @var ?DateTimeImmutable
+ */
+ private $createdAt;
+
+ /**
+
+ * @var null|ImportUnresolvedEventData|ImportUnresolvedEventDataBuilder
+ */
+ private $data;
+
+ /**
+ * Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *An object containing details of the Import Operation with the unresolved state.
id of the Import Operation with the unresolved state.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * The version of the Import Operation with the unresolved state.
The key of the Import Container.
The id of the Import Operation with the unresolved state.
The version of the Import Operation with the unresolved state.
The key of the Import Container.
The id of the Import Operation with the unresolved state.
The version of the Import Operation with the unresolved state.
The key of the Import Container.
Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + /** + *An object containing details of the Import Operation with the unresolved state.
validationFailed state.
+ *
+
+ * @return null|ImportValidationFailedEventData
+ */
+ public function getData();
+
+ /**
+ * @param ?string $resourceType
+ */
+ public function setResourceType(?string $resourceType): void;
+
+ /**
+ * @param ?ImportValidationFailedEventData $data
+ */
+ public function setData(?ImportValidationFailedEventData $data): void;
+}
diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventBuilder.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventBuilder.php
new file mode 100644
index 00000000000..ffb276caacf
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventBuilder.php
@@ -0,0 +1,186 @@
+
+ */
+final class ImportValidationFailedEventBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $id;
+
+ /**
+
+ * @var ?string
+ */
+ private $notificationType;
+
+ /**
+
+ * @var ?string
+ */
+ private $resourceType;
+
+ /**
+
+ * @var ?DateTimeImmutable
+ */
+ private $createdAt;
+
+ /**
+
+ * @var null|ImportValidationFailedEventData|ImportValidationFailedEventDataBuilder
+ */
+ private $data;
+
+ /**
+ * Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *An object containing details of the Import Operation with the validationFailed state.
id of the Import Operation with the validationFailed state.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * The version of the Import Operation with the validationFailed state.
The key of the Import Container.
The id of the Import Operation with the validationFailed state.
The version of the Import Operation with the validationFailed state.
The key of the Import Container.
The id of the Import Operation with the validationFailed state.
The version of the Import Operation with the validationFailed state.
The key of the Import Container.
Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + /** + *An object containing details of the Import Operation with the validationFailed state.
waitForMasterVariant state.
+ *
+
+ * @return null|ImportWaitForMasterVariantEventData
+ */
+ public function getData();
+
+ /**
+ * @param ?string $resourceType
+ */
+ public function setResourceType(?string $resourceType): void;
+
+ /**
+ * @param ?ImportWaitForMasterVariantEventData $data
+ */
+ public function setData(?ImportWaitForMasterVariantEventData $data): void;
+}
diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventBuilder.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventBuilder.php
new file mode 100644
index 00000000000..b041b3ff040
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventBuilder.php
@@ -0,0 +1,186 @@
+
+ */
+final class ImportWaitForMasterVariantEventBuilder implements Builder
+{
+ /**
+
+ * @var ?string
+ */
+ private $id;
+
+ /**
+
+ * @var ?string
+ */
+ private $notificationType;
+
+ /**
+
+ * @var ?string
+ */
+ private $resourceType;
+
+ /**
+
+ * @var ?DateTimeImmutable
+ */
+ private $createdAt;
+
+ /**
+
+ * @var null|ImportWaitForMasterVariantEventData|ImportWaitForMasterVariantEventDataBuilder
+ */
+ private $data;
+
+ /**
+ * Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + + * @return null|string + */ + public function getNotificationType() + { + return $this->notificationType; + } + + /** + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *Date and time (UTC) the Event was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *An object containing details of the Import Operation with the waitForMasterVariant state.
id of the Import Operation with the waitForMasterVariant state.
+ *
+
+ * @return null|string
+ */
+ public function getId();
+
+ /**
+ * The version of the Import Operation with the waitForMasterVariant state.
The key of the Import Container.
The id of the Import Operation with the waitForMasterVariant state.
The version of the Import Operation with the waitForMasterVariant state.
The key of the Import Container.
The id of the Import Operation with the waitForMasterVariant state.
The version of the Import Operation with the waitForMasterVariant state.
The key of the Import Container.
Unique identifier of the Event.
+ * + * + * @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; + } + + /** + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *Date and time (UTC) the Event 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; + } + + /** + *An object containing details of the Import Operation with the waitForMasterVariant state.
Top-level unit of the Business Unit before the Set Unit Type or Change Parent Unit update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldTopLevelUnit(); + + /** + * @param ?BusinessUnitKeyReference $topLevelUnit + */ + public function setTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit): void; + + /** + * @param ?BusinessUnitKeyReference $oldTopLevelUnit + */ + public function setOldTopLevelUnit(?BusinessUnitKeyReference $oldTopLevelUnit): void; +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageBuilder.php new file mode 100644 index 00000000000..e01219ac747 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageBuilder.php @@ -0,0 +1,457 @@ + + */ +final class BusinessUnitTopLevelUnitSetMessageBuilder 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|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $topLevelUnit; + + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $oldTopLevelUnit; + + /** + *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.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Top-level unit of the Business Unit after the Set Unit Type or Change Parent Unit update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getTopLevelUnit() + { + return $this->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit; + } + + /** + *Top-level unit of the Business Unit before the Set Unit Type or Change Parent Unit update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldTopLevelUnit() + { + return $this->oldTopLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldTopLevelUnit->build() : $this->oldTopLevelUnit; + } + + /** + * @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 ?BusinessUnitKeyReference $topLevelUnit + * @return $this + */ + public function withTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit) + { + $this->topLevelUnit = $topLevelUnit; + + return $this; + } + + /** + * @param ?BusinessUnitKeyReference $oldTopLevelUnit + * @return $this + */ + public function withOldTopLevelUnit(?BusinessUnitKeyReference $oldTopLevelUnit) + { + $this->oldTopLevelUnit = $oldTopLevelUnit; + + 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 withTopLevelUnit() instead + * @return $this + */ + public function withTopLevelUnitBuilder(?BusinessUnitKeyReferenceBuilder $topLevelUnit) + { + $this->topLevelUnit = $topLevelUnit; + + return $this; + } + + /** + * @deprecated use withOldTopLevelUnit() instead + * @return $this + */ + public function withOldTopLevelUnitBuilder(?BusinessUnitKeyReferenceBuilder $oldTopLevelUnit) + { + $this->oldTopLevelUnit = $oldTopLevelUnit; + + return $this; + } + + public function build(): BusinessUnitTopLevelUnitSetMessage + { + return new BusinessUnitTopLevelUnitSetMessageModel( + $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->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit, + $this->oldTopLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldTopLevelUnit->build() : $this->oldTopLevelUnit + ); + } + + public static function of(): BusinessUnitTopLevelUnitSetMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageCollection.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageCollection.php new file mode 100644 index 00000000000..f25781c52f8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitTopLevelUnitSetMessage current() + * @method BusinessUnitTopLevelUnitSetMessage end() + * @method BusinessUnitTopLevelUnitSetMessage at($offset) + */ +class BusinessUnitTopLevelUnitSetMessageCollection extends MessageCollection +{ + /** + * @psalm-assert BusinessUnitTopLevelUnitSetMessage $value + * @psalm-param BusinessUnitTopLevelUnitSetMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitTopLevelUnitSetMessageCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitTopLevelUnitSetMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitTopLevelUnitSetMessage + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitTopLevelUnitSetMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitTopLevelUnitSetMessage $data */ + $data = BusinessUnitTopLevelUnitSetMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageModel.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageModel.php new file mode 100644 index 00000000000..98293288983 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessageModel.php @@ -0,0 +1,530 @@ +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->topLevelUnit = $topLevelUnit; + $this->oldTopLevelUnit = $oldTopLevelUnit; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Top-level unit of the Business Unit after the Set Unit Type or Change Parent Unit update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getTopLevelUnit() + { + if (is_null($this->topLevelUnit)) { + /** @psalm-var stdClass|arrayTop-level unit of the Business Unit before the Set Unit Type or Change Parent Unit update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getOldTopLevelUnit() + { + if (is_null($this->oldTopLevelUnit)) { + /** @psalm-var stdClass|arrayTop-level unit of the Business Unit before the Set Unit Type or Change Parent Unit update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldTopLevelUnit(); + + /** + * @param ?BusinessUnitKeyReference $topLevelUnit + */ + public function setTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit): void; + + /** + * @param ?BusinessUnitKeyReference $oldTopLevelUnit + */ + public function setOldTopLevelUnit(?BusinessUnitKeyReference $oldTopLevelUnit): void; +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadBuilder.php new file mode 100644 index 00000000000..9e2e632a3f6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadBuilder.php @@ -0,0 +1,115 @@ + + */ +final class BusinessUnitTopLevelUnitSetMessagePayloadBuilder implements Builder +{ + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $topLevelUnit; + + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $oldTopLevelUnit; + + /** + *Top-level unit of the Business Unit after the Set Unit Type or Change Parent Unit update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getTopLevelUnit() + { + return $this->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit; + } + + /** + *Top-level unit of the Business Unit before the Set Unit Type or Change Parent Unit update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldTopLevelUnit() + { + return $this->oldTopLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldTopLevelUnit->build() : $this->oldTopLevelUnit; + } + + /** + * @param ?BusinessUnitKeyReference $topLevelUnit + * @return $this + */ + public function withTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit) + { + $this->topLevelUnit = $topLevelUnit; + + return $this; + } + + /** + * @param ?BusinessUnitKeyReference $oldTopLevelUnit + * @return $this + */ + public function withOldTopLevelUnit(?BusinessUnitKeyReference $oldTopLevelUnit) + { + $this->oldTopLevelUnit = $oldTopLevelUnit; + + return $this; + } + + /** + * @deprecated use withTopLevelUnit() instead + * @return $this + */ + public function withTopLevelUnitBuilder(?BusinessUnitKeyReferenceBuilder $topLevelUnit) + { + $this->topLevelUnit = $topLevelUnit; + + return $this; + } + + /** + * @deprecated use withOldTopLevelUnit() instead + * @return $this + */ + public function withOldTopLevelUnitBuilder(?BusinessUnitKeyReferenceBuilder $oldTopLevelUnit) + { + $this->oldTopLevelUnit = $oldTopLevelUnit; + + return $this; + } + + public function build(): BusinessUnitTopLevelUnitSetMessagePayload + { + return new BusinessUnitTopLevelUnitSetMessagePayloadModel( + $this->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit, + $this->oldTopLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldTopLevelUnit->build() : $this->oldTopLevelUnit + ); + } + + public static function of(): BusinessUnitTopLevelUnitSetMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadCollection.php new file mode 100644 index 00000000000..2496169191d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitTopLevelUnitSetMessagePayload current() + * @method BusinessUnitTopLevelUnitSetMessagePayload end() + * @method BusinessUnitTopLevelUnitSetMessagePayload at($offset) + */ +class BusinessUnitTopLevelUnitSetMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert BusinessUnitTopLevelUnitSetMessagePayload $value + * @psalm-param BusinessUnitTopLevelUnitSetMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitTopLevelUnitSetMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitTopLevelUnitSetMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitTopLevelUnitSetMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitTopLevelUnitSetMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitTopLevelUnitSetMessagePayload $data */ + $data = BusinessUnitTopLevelUnitSetMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadModel.php new file mode 100644 index 00000000000..f771e73877c --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayloadModel.php @@ -0,0 +1,133 @@ +topLevelUnit = $topLevelUnit; + $this->oldTopLevelUnit = $oldTopLevelUnit; + $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; + } + + /** + *Top-level unit of the Business Unit after the Set Unit Type or Change Parent Unit update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getTopLevelUnit() + { + if (is_null($this->topLevelUnit)) { + /** @psalm-var stdClass|arrayTop-level unit of the Business Unit before the Set Unit Type or Change Parent Unit update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getOldTopLevelUnit() + { + if (is_null($this->oldTopLevelUnit)) { + /** @psalm-var stdClass|arrayParent unit of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldParentUnit(); + + /** + *Type of the Business Unit after the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getUnitType(); + + /** + *Type of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getOldUnitType(); + + /** + * @param ?BusinessUnitKeyReference $parentUnit + */ + public function setParentUnit(?BusinessUnitKeyReference $parentUnit): void; + + /** + * @param ?BusinessUnitKeyReference $oldParentUnit + */ + public function setOldParentUnit(?BusinessUnitKeyReference $oldParentUnit): void; + + /** + * @param ?string $unitType + */ + public function setUnitType(?string $unitType): void; + + /** + * @param ?string $oldUnitType + */ + public function setOldUnitType(?string $oldUnitType): void; +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageBuilder.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageBuilder.php new file mode 100644 index 00000000000..8ac2e0a7508 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageBuilder.php @@ -0,0 +1,515 @@ + + */ +final class BusinessUnitTypeSetMessageBuilder 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|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $parentUnit; + + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $oldParentUnit; + + /** + + * @var ?string + */ + private $unitType; + + /** + + * @var ?string + */ + private $oldUnitType; + + /** + *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.
Date and time (UTC) the Message was generated.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *IDs and references that created the Message.
+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *Version of the resource on which the change or action was performed.
+ * + + * @return null|int + */ + public function getResourceVersion() + { + return $this->resourceVersion; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Parent unit of the Business Unit after the Set Unit Type update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getParentUnit() + { + return $this->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit; + } + + /** + *Parent unit of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldParentUnit() + { + return $this->oldParentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldParentUnit->build() : $this->oldParentUnit; + } + + /** + *Type of the Business Unit after the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getUnitType() + { + return $this->unitType; + } + + /** + *Type of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getOldUnitType() + { + return $this->oldUnitType; + } + + /** + * @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 ?BusinessUnitKeyReference $parentUnit + * @return $this + */ + public function withParentUnit(?BusinessUnitKeyReference $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + /** + * @param ?BusinessUnitKeyReference $oldParentUnit + * @return $this + */ + public function withOldParentUnit(?BusinessUnitKeyReference $oldParentUnit) + { + $this->oldParentUnit = $oldParentUnit; + + return $this; + } + + /** + * @param ?string $unitType + * @return $this + */ + public function withUnitType(?string $unitType) + { + $this->unitType = $unitType; + + return $this; + } + + /** + * @param ?string $oldUnitType + * @return $this + */ + public function withOldUnitType(?string $oldUnitType) + { + $this->oldUnitType = $oldUnitType; + + 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 withParentUnit() instead + * @return $this + */ + public function withParentUnitBuilder(?BusinessUnitKeyReferenceBuilder $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + /** + * @deprecated use withOldParentUnit() instead + * @return $this + */ + public function withOldParentUnitBuilder(?BusinessUnitKeyReferenceBuilder $oldParentUnit) + { + $this->oldParentUnit = $oldParentUnit; + + return $this; + } + + public function build(): BusinessUnitTypeSetMessage + { + return new BusinessUnitTypeSetMessageModel( + $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->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit, + $this->oldParentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldParentUnit->build() : $this->oldParentUnit, + $this->unitType, + $this->oldUnitType + ); + } + + public static function of(): BusinessUnitTypeSetMessageBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageCollection.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageCollection.php new file mode 100644 index 00000000000..48b6691b6f7 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitTypeSetMessage current() + * @method BusinessUnitTypeSetMessage end() + * @method BusinessUnitTypeSetMessage at($offset) + */ +class BusinessUnitTypeSetMessageCollection extends MessageCollection +{ + /** + * @psalm-assert BusinessUnitTypeSetMessage $value + * @psalm-param BusinessUnitTypeSetMessage|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitTypeSetMessageCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitTypeSetMessage) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitTypeSetMessage + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitTypeSetMessage { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitTypeSetMessage $data */ + $data = BusinessUnitTypeSetMessageModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageModel.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageModel.php new file mode 100644 index 00000000000..a08690b95f2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessageModel.php @@ -0,0 +1,602 @@ +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->parentUnit = $parentUnit; + $this->oldParentUnit = $oldParentUnit; + $this->unitType = $unitType; + $this->oldUnitType = $oldUnitType; + $this->type = $type ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Unique identifier of the Message. Can be used to track which Messages have been processed.
+ * + * + * @return null|string + */ + public function getId() + { + if (is_null($this->id)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ID); + if (is_null($data)) { + return null; + } + $this->id = (string) $data; + } + + return $this->id; + } + + /** + *Version of a resource. In case of Messages, this is always 1.
Date and time (UTC) the Message was generated.
+ * + * + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + if (is_null($this->createdAt)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_CREATED_AT); + if (is_null($data)) { + return null; + } + $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data); + if (false === $data) { + return null; + } + $this->createdAt = $data; + } + + return $this->createdAt; + } + + /** + *Value of createdAt.
IDs and references that last modified the Message.
+ * + * + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + if (is_null($this->lastModifiedBy)) { + /** @psalm-var stdClass|arrayIDs and references that created the Message.
+ * + * + * @return null|CreatedBy + */ + public function getCreatedBy() + { + if (is_null($this->createdBy)) { + /** @psalm-var stdClass|arrayMessage number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1.
+ * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.
Reference to the resource on which the change or action was performed.
+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|arrayVersion of the resource on which the change or action was performed.
+ * + * + * @return null|int + */ + public function getResourceVersion() + { + if (is_null($this->resourceVersion)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_RESOURCE_VERSION); + if (is_null($data)) { + return null; + } + $this->resourceVersion = (int) $data; + } + + return $this->resourceVersion; + } + + /** + *Message Type of the Message.
+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.
Parent unit of the Business Unit after the Set Unit Type update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getParentUnit() + { + if (is_null($this->parentUnit)) { + /** @psalm-var stdClass|arrayParent unit of the Business Unit before the Set Unit Type update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getOldParentUnit() + { + if (is_null($this->oldParentUnit)) { + /** @psalm-var stdClass|arrayType of the Business Unit after the Set Unit Type update action.
+ * + * + * @return null|string + */ + public function getUnitType() + { + if (is_null($this->unitType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_UNIT_TYPE); + if (is_null($data)) { + return null; + } + $this->unitType = (string) $data; + } + + return $this->unitType; + } + + /** + *Type of the Business Unit before the Set Unit Type update action.
+ * + * + * @return null|string + */ + public function getOldUnitType() + { + if (is_null($this->oldUnitType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_UNIT_TYPE); + if (is_null($data)) { + return null; + } + $this->oldUnitType = (string) $data; + } + + return $this->oldUnitType; + } + + + /** + * @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 ?BusinessUnitKeyReference $parentUnit + */ + public function setParentUnit(?BusinessUnitKeyReference $parentUnit): void + { + $this->parentUnit = $parentUnit; + } + + /** + * @param ?BusinessUnitKeyReference $oldParentUnit + */ + public function setOldParentUnit(?BusinessUnitKeyReference $oldParentUnit): void + { + $this->oldParentUnit = $oldParentUnit; + } + + /** + * @param ?string $unitType + */ + public function setUnitType(?string $unitType): void + { + $this->unitType = $unitType; + } + + /** + * @param ?string $oldUnitType + */ + public function setOldUnitType(?string $oldUnitType): void + { + $this->oldUnitType = $oldUnitType; + } + + + #[\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/BusinessUnitTypeSetMessagePayload.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayload.php new file mode 100644 index 00000000000..ffc1f01ae9d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayload.php @@ -0,0 +1,73 @@ +Parent unit of the Business Unit after the Set Unit Type update action. + * + + * @return null|BusinessUnitKeyReference + */ + public function getParentUnit(); + + /** + *Parent unit of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldParentUnit(); + + /** + *Type of the Business Unit after the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getUnitType(); + + /** + *Type of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getOldUnitType(); + + /** + * @param ?BusinessUnitKeyReference $parentUnit + */ + public function setParentUnit(?BusinessUnitKeyReference $parentUnit): void; + + /** + * @param ?BusinessUnitKeyReference $oldParentUnit + */ + public function setOldParentUnit(?BusinessUnitKeyReference $oldParentUnit): void; + + /** + * @param ?string $unitType + */ + public function setUnitType(?string $unitType): void; + + /** + * @param ?string $oldUnitType + */ + public function setOldUnitType(?string $oldUnitType): void; +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadBuilder.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadBuilder.php new file mode 100644 index 00000000000..8bfe07c68e8 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadBuilder.php @@ -0,0 +1,173 @@ + + */ +final class BusinessUnitTypeSetMessagePayloadBuilder implements Builder +{ + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $parentUnit; + + /** + + * @var null|BusinessUnitKeyReference|BusinessUnitKeyReferenceBuilder + */ + private $oldParentUnit; + + /** + + * @var ?string + */ + private $unitType; + + /** + + * @var ?string + */ + private $oldUnitType; + + /** + *Parent unit of the Business Unit after the Set Unit Type update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getParentUnit() + { + return $this->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit; + } + + /** + *Parent unit of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|BusinessUnitKeyReference + */ + public function getOldParentUnit() + { + return $this->oldParentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldParentUnit->build() : $this->oldParentUnit; + } + + /** + *Type of the Business Unit after the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getUnitType() + { + return $this->unitType; + } + + /** + *Type of the Business Unit before the Set Unit Type update action.
+ * + + * @return null|string + */ + public function getOldUnitType() + { + return $this->oldUnitType; + } + + /** + * @param ?BusinessUnitKeyReference $parentUnit + * @return $this + */ + public function withParentUnit(?BusinessUnitKeyReference $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + /** + * @param ?BusinessUnitKeyReference $oldParentUnit + * @return $this + */ + public function withOldParentUnit(?BusinessUnitKeyReference $oldParentUnit) + { + $this->oldParentUnit = $oldParentUnit; + + return $this; + } + + /** + * @param ?string $unitType + * @return $this + */ + public function withUnitType(?string $unitType) + { + $this->unitType = $unitType; + + return $this; + } + + /** + * @param ?string $oldUnitType + * @return $this + */ + public function withOldUnitType(?string $oldUnitType) + { + $this->oldUnitType = $oldUnitType; + + return $this; + } + + /** + * @deprecated use withParentUnit() instead + * @return $this + */ + public function withParentUnitBuilder(?BusinessUnitKeyReferenceBuilder $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + /** + * @deprecated use withOldParentUnit() instead + * @return $this + */ + public function withOldParentUnitBuilder(?BusinessUnitKeyReferenceBuilder $oldParentUnit) + { + $this->oldParentUnit = $oldParentUnit; + + return $this; + } + + public function build(): BusinessUnitTypeSetMessagePayload + { + return new BusinessUnitTypeSetMessagePayloadModel( + $this->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit, + $this->oldParentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->oldParentUnit->build() : $this->oldParentUnit, + $this->unitType, + $this->oldUnitType + ); + } + + public static function of(): BusinessUnitTypeSetMessagePayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadCollection.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadCollection.php new file mode 100644 index 00000000000..14d91830a20 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitTypeSetMessagePayload current() + * @method BusinessUnitTypeSetMessagePayload end() + * @method BusinessUnitTypeSetMessagePayload at($offset) + */ +class BusinessUnitTypeSetMessagePayloadCollection extends MessagePayloadCollection +{ + /** + * @psalm-assert BusinessUnitTypeSetMessagePayload $value + * @psalm-param BusinessUnitTypeSetMessagePayload|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitTypeSetMessagePayloadCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitTypeSetMessagePayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitTypeSetMessagePayload + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitTypeSetMessagePayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitTypeSetMessagePayload $data */ + $data = BusinessUnitTypeSetMessagePayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadModel.php new file mode 100644 index 00000000000..b521cc924d0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessagePayloadModel.php @@ -0,0 +1,205 @@ +parentUnit = $parentUnit; + $this->oldParentUnit = $oldParentUnit; + $this->unitType = $unitType; + $this->oldUnitType = $oldUnitType; + $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; + } + + /** + *Parent unit of the Business Unit after the Set Unit Type update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getParentUnit() + { + if (is_null($this->parentUnit)) { + /** @psalm-var stdClass|arrayParent unit of the Business Unit before the Set Unit Type update action.
+ * + * + * @return null|BusinessUnitKeyReference + */ + public function getOldParentUnit() + { + if (is_null($this->oldParentUnit)) { + /** @psalm-var stdClass|arrayType of the Business Unit after the Set Unit Type update action.
+ * + * + * @return null|string + */ + public function getUnitType() + { + if (is_null($this->unitType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_UNIT_TYPE); + if (is_null($data)) { + return null; + } + $this->unitType = (string) $data; + } + + return $this->unitType; + } + + /** + *Type of the Business Unit before the Set Unit Type update action.
+ * + * + * @return null|string + */ + public function getOldUnitType() + { + if (is_null($this->oldUnitType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_OLD_UNIT_TYPE); + if (is_null($data)) { + return null; + } + $this->oldUnitType = (string) $data; + } + + return $this->oldUnitType; + } + + + /** + * @param ?BusinessUnitKeyReference $parentUnit + */ + public function setParentUnit(?BusinessUnitKeyReference $parentUnit): void + { + $this->parentUnit = $parentUnit; + } + + /** + * @param ?BusinessUnitKeyReference $oldParentUnit + */ + public function setOldParentUnit(?BusinessUnitKeyReference $oldParentUnit): void + { + $this->oldParentUnit = $oldParentUnit; + } + + /** + * @param ?string $unitType + */ + public function setUnitType(?string $unitType): void + { + $this->unitType = $unitType; + } + + /** + * @param ?string $oldUnitType + */ + public function setOldUnitType(?string $oldUnitType): void + { + $this->oldUnitType = $oldUnitType; + } +} diff --git a/lib/commercetools-api/src/Models/Message/MessageModel.php b/lib/commercetools-api/src/Models/Message/MessageModel.php index 41fca43f3ad..bed52e64945 100644 --- a/lib/commercetools-api/src/Models/Message/MessageModel.php +++ b/lib/commercetools-api/src/Models/Message/MessageModel.php @@ -154,6 +154,8 @@ final class MessageModel extends JsonObjectModel implements Message 'BusinessUnitStoreModeChanged' => BusinessUnitStoreModeChangedMessageModel::class, 'BusinessUnitStoreRemoved' => BusinessUnitStoreRemovedMessageModel::class, 'BusinessUnitStoresSet' => BusinessUnitStoresSetMessageModel::class, + 'BusinessUnitTopLevelUnitSet' => BusinessUnitTopLevelUnitSetMessageModel::class, + 'BusinessUnitTypeSet' => BusinessUnitTypeSetMessageModel::class, 'CartDiscountCreated' => CartDiscountCreatedMessageModel::class, 'CartDiscountDeleted' => CartDiscountDeletedMessageModel::class, 'CartDiscountStoreAdded' => CartDiscountStoreAddedMessageModel::class, diff --git a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php index 0a89d7da8ac..6781a129948 100644 --- a/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php +++ b/lib/commercetools-api/src/Models/Message/MessagePayloadModel.php @@ -85,6 +85,8 @@ final class MessagePayloadModel extends JsonObjectModel implements MessagePayloa 'BusinessUnitStoreModeChanged' => BusinessUnitStoreModeChangedMessagePayloadModel::class, 'BusinessUnitStoreRemoved' => BusinessUnitStoreRemovedMessagePayloadModel::class, 'BusinessUnitStoresSet' => BusinessUnitStoresSetMessagePayloadModel::class, + 'BusinessUnitTopLevelUnitSet' => BusinessUnitTopLevelUnitSetMessagePayloadModel::class, + 'BusinessUnitTypeSet' => BusinessUnitTypeSetMessagePayloadModel::class, 'CartDiscountCreated' => CartDiscountCreatedMessagePayloadModel::class, 'CartDiscountDeleted' => CartDiscountDeletedMessagePayloadModel::class, 'CartDiscountStoreAdded' => CartDiscountStoreAddedMessagePayloadModel::class, diff --git a/lib/commercetools-api/src/Models/Subscription/CloudEventsPayload.php b/lib/commercetools-api/src/Models/Subscription/CloudEventsPayload.php index fab94c6005a..0360219619d 100644 --- a/lib/commercetools-api/src/Models/Subscription/CloudEventsPayload.php +++ b/lib/commercetools-api/src/Models/Subscription/CloudEventsPayload.php @@ -99,7 +99,7 @@ public function getSequencetype(); public function getDataref(); /** - *MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
+ *MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload, EventDeliveryPayload.
* * @return null|DeliveryPayload diff --git a/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadBuilder.php b/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadBuilder.php index 72aeb6eb948..7ca5309d9db 100644 --- a/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadBuilder.php +++ b/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadBuilder.php @@ -182,7 +182,7 @@ public function getDataref() } /** - *MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
+ *MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload, EventDeliveryPayload.
* * @return null|DeliveryPayload diff --git a/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadModel.php index c0897a65730..13e92e648f5 100644 --- a/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadModel.php +++ b/lib/commercetools-api/src/Models/Subscription/CloudEventsPayloadModel.php @@ -295,7 +295,7 @@ public function getDataref() } /** - *MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
+ *MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload, EventDeliveryPayload.
* * * @return null|DeliveryPayload @@ -308,8 +308,8 @@ public function getData() if (is_null($data)) { return null; } - $className = DeliveryPayloadModel::resolveDiscriminatorClass($data); - $this->data = $className::of($data); + + $this->data = DeliveryPayloadModel::of($data); } return $this->data; diff --git a/lib/commercetools-api/src/Models/Subscription/DeliveryPayload.php b/lib/commercetools-api/src/Models/Subscription/DeliveryPayload.php index 153f8295f6e..3c2be72ff69 100644 --- a/lib/commercetools-api/src/Models/Subscription/DeliveryPayload.php +++ b/lib/commercetools-api/src/Models/Subscription/DeliveryPayload.php @@ -13,11 +13,9 @@ use Commercetools\Base\DateTimeImmutableCollection; use Commercetools\Base\JsonObject; -interface DeliveryPayload extends JsonObject +interface DeliveryPayload extends SubscriptionNotification { - public const DISCRIMINATOR_FIELD = 'notificationType'; public const FIELD_PROJECT_KEY = 'projectKey'; - public const FIELD_NOTIFICATION_TYPE = 'notificationType'; public const FIELD_RESOURCE = 'resource'; public const FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS = 'resourceUserProvidedIdentifiers'; @@ -30,14 +28,6 @@ interface DeliveryPayload extends JsonObject */ public function getProjectKey(); - /** - *Identifies the payload.
- * - - * @return null|string - */ - public function getNotificationType(); - /** *Reference to the resource that triggered the notification.
* diff --git a/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadCollection.php b/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadCollection.php index 5f65337b4c6..d99f8173d67 100644 --- a/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadCollection.php +++ b/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadCollection.php @@ -8,13 +8,13 @@ namespace Commercetools\Api\Models\Subscription; -use Commercetools\Base\MapperSequence; +use Commercetools\Api\Models\Subscription\SubscriptionNotificationCollection; use Commercetools\Exception\InvalidArgumentException; use stdClass; /** * @template T of DeliveryPayload - * @extends MapperSequencekey of the Project.
- * Useful for processing notifications if the Destination receives them from multiple Projects.
Identifies the payload.
* * * @return null|string */ - public function getProjectKey() + public function getNotificationType() { - if (is_null($this->projectKey)) { + if (is_null($this->notificationType)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_PROJECT_KEY); + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); if (is_null($data)) { return null; } - $this->projectKey = (string) $data; + $this->notificationType = (string) $data; } - return $this->projectKey; + return $this->notificationType; } /** - *Identifies the payload.
+ *key of the Project.
+ * Useful for processing notifications if the Destination receives them from multiple Projects.
The type of Event that has occurred.
+ * + + * @return null|string + */ + public function getType(); + + /** + *The type of resource targeted by the Event.
+ * + + * @return null|string + */ + public function getResourceType(); + + /** + *The data describing the event that has taken place.
+ * + + * @return null|mixed + */ + public function getData(); + + /** + *Date and time (UTC) the resource was initially created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?string $type + */ + public function setType(?string $type): void; + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void; + + /** + * @param ?JsonObject $data + */ + public function setData(?JsonObject $data): void; + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void; +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadBuilder.php b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadBuilder.php new file mode 100644 index 00000000000..ca8063e487d --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadBuilder.php @@ -0,0 +1,180 @@ + + */ +final class EventDeliveryPayloadBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?string + */ + private $type; + + /** + + * @var ?string + */ + private $resourceType; + + /** + + * @var ?JsonObject + */ + private $data; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + *Unique identifier of the Event.
+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *The type of Event that has occurred.
+ * + + * @return null|string + */ + public function getType() + { + return $this->type; + } + + /** + *The type of resource targeted by the Event.
+ * + + * @return null|string + */ + public function getResourceType() + { + return $this->resourceType; + } + + /** + *The data describing the event that has taken place.
+ * + + * @return null|JsonObject + */ + public function getData() + { + return $this->data; + } + + /** + *Date and time (UTC) the resource was initially created.
+ * + + * @return null|DateTimeImmutable + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + /** + * @param ?string $type + * @return $this + */ + public function withType(?string $type) + { + $this->type = $type; + + return $this; + } + + /** + * @param ?string $resourceType + * @return $this + */ + public function withResourceType(?string $resourceType) + { + $this->resourceType = $resourceType; + + return $this; + } + + /** + * @param ?JsonObject $data + * @return $this + */ + public function withData(?JsonObject $data) + { + $this->data = $data; + + return $this; + } + + /** + * @param ?DateTimeImmutable $createdAt + * @return $this + */ + public function withCreatedAt(?DateTimeImmutable $createdAt) + { + $this->createdAt = $createdAt; + + return $this; + } + + + public function build(): EventDeliveryPayload + { + return new EventDeliveryPayloadModel( + $this->id, + $this->type, + $this->resourceType, + $this->data, + $this->createdAt + ); + } + + public static function of(): EventDeliveryPayloadBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadCollection.php b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadCollection.php new file mode 100644 index 00000000000..b61aaa56686 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadCollection.php @@ -0,0 +1,56 @@ + + * @method EventDeliveryPayload current() + * @method EventDeliveryPayload end() + * @method EventDeliveryPayload at($offset) + */ +class EventDeliveryPayloadCollection extends SubscriptionNotificationCollection +{ + /** + * @psalm-assert EventDeliveryPayload $value + * @psalm-param EventDeliveryPayload|stdClass $value + * @throws InvalidArgumentException + * + * @return EventDeliveryPayloadCollection + */ + public function add($value) + { + if (!$value instanceof EventDeliveryPayload) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?EventDeliveryPayload + */ + protected function mapper() + { + return function (?int $index): ?EventDeliveryPayload { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var EventDeliveryPayload $data */ + $data = EventDeliveryPayloadModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadModel.php new file mode 100644 index 00000000000..06b0fe9d9d2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayloadModel.php @@ -0,0 +1,255 @@ +id = $id; + $this->type = $type; + $this->resourceType = $resourceType; + $this->data = $data; + $this->createdAt = $createdAt; + $this->notificationType = $notificationType ?? self::DISCRIMINATOR_VALUE; + } + + /** + *Identifies the payload.
+ * + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + /** + *Unique identifier of the Event.
+ * + * + * @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; + } + + /** + *The type of Event that has occurred.
+ * + * + * @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; + } + + /** + *The type of resource targeted by the Event.
+ * + * + * @return null|string + */ + public function getResourceType() + { + if (is_null($this->resourceType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE); + if (is_null($data)) { + return null; + } + $this->resourceType = (string) $data; + } + + return $this->resourceType; + } + + /** + *The data describing the event that has taken place.
+ * + * + * @return null|mixed + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|arrayDate and time (UTC) the resource was initially created.
+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } + + /** + * @param ?string $type + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void + { + $this->resourceType = $resourceType; + } + + /** + * @param ?JsonObject $data + */ + public function setData(?JsonObject $data): void + { + $this->data = $data; + } + + /** + * @param ?DateTimeImmutable $createdAt + */ + public function setCreatedAt(?DateTimeImmutable $createdAt): void + { + $this->createdAt = $createdAt; + } + + + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = $this->toArray(); + if (isset($data[EventDeliveryPayload::FIELD_CREATED_AT]) && $data[EventDeliveryPayload::FIELD_CREATED_AT] instanceof \DateTimeImmutable) { + $data[EventDeliveryPayload::FIELD_CREATED_AT] = $data[EventDeliveryPayload::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c'); + } + return (object) $data; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventSubscription.php b/lib/commercetools-api/src/Models/Subscription/EventSubscription.php new file mode 100644 index 00000000000..98049c31b00 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventSubscription.php @@ -0,0 +1,46 @@ +Unique identifier for the type of resource, for example,import-api.
+ *
+
+ * @return null|string
+ */
+ public function getResourceTypeId();
+
+ /**
+ * Must contain valid event types for the resource.
+ * For example, for resource type import-api the event type ImportContainerCreated is valid.
+ * If no types are given, the Subscription will receive all events for this resource.
Unique identifier for the type of resource, for example, import-api.
Must contain valid event types for the resource.
+ * For example, for resource type import-api the event type ImportContainerCreated is valid.
+ * If no types are given, the Subscription will receive all events for this resource.
Unique identifier for the type of resource, for example, import-api.
Must contain valid event types for the resource.
+ * For example, for resource type import-api the event type ImportContainerCreated is valid.
+ * If no types are given, the Subscription will receive all events for this resource.
key of the Project.
- * Useful for processing notifications if the Destination receives them from multiple Projects.
Identifies the payload.
* * * @return null|string */ - public function getProjectKey() + public function getNotificationType() { - if (is_null($this->projectKey)) { + if (is_null($this->notificationType)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_PROJECT_KEY); + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); if (is_null($data)) { return null; } - $this->projectKey = (string) $data; + $this->notificationType = (string) $data; } - return $this->projectKey; + return $this->notificationType; } /** - *Identifies the payload.
+ *key of the Project.
+ * Useful for processing notifications if the Destination receives them from multiple Projects.
key of the Project.
- * Useful for processing notifications if the Destination receives them from multiple Projects.
Identifies the payload.
* * * @return null|string */ - public function getProjectKey() + public function getNotificationType() { - if (is_null($this->projectKey)) { + if (is_null($this->notificationType)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_PROJECT_KEY); + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); if (is_null($data)) { return null; } - $this->projectKey = (string) $data; + $this->notificationType = (string) $data; } - return $this->projectKey; + return $this->notificationType; } /** - *Identifies the payload.
+ *key of the Project.
+ * Useful for processing notifications if the Destination receives them from multiple Projects.
key of the Project.
- * Useful for processing notifications if the Destination receives them from multiple Projects.
Identifies the payload.
* * * @return null|string */ - public function getProjectKey() + public function getNotificationType() { - if (is_null($this->projectKey)) { + if (is_null($this->notificationType)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_PROJECT_KEY); + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); if (is_null($data)) { return null; } - $this->projectKey = (string) $data; + $this->notificationType = (string) $data; } - return $this->projectKey; + return $this->notificationType; } /** - *Identifies the payload.
+ *key of the Project.
+ * Useful for processing notifications if the Destination receives them from multiple Projects.
key of the Project.
- * Useful for processing notifications if the Destination receives them from multiple Projects.
Identifies the payload.
* * * @return null|string */ - public function getProjectKey() + public function getNotificationType() { - if (is_null($this->projectKey)) { + if (is_null($this->notificationType)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_PROJECT_KEY); + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); if (is_null($data)) { return null; } - $this->projectKey = (string) $data; + $this->notificationType = (string) $data; } - return $this->projectKey; + return $this->notificationType; } /** - *Identifies the payload.
+ *key of the Project.
+ * Useful for processing notifications if the Destination receives them from multiple Projects.
Events subscribed to.
+ * + + * @return null|EventSubscriptionCollection + */ + public function getEvents(); + /** *Format in which the payload is delivered.
* @@ -172,6 +181,11 @@ public function setKey(?string $key): void; */ public function setMessages(?MessageSubscriptionCollection $messages): void; + /** + * @param ?EventSubscriptionCollection $events + */ + public function setEvents(?EventSubscriptionCollection $events): void; + /** * @param ?DeliveryFormat $format */ diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionBuilder.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionBuilder.php index f6e011797a5..e4566250d5e 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionBuilder.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionBuilder.php @@ -87,6 +87,12 @@ final class SubscriptionBuilder implements Builder */ private $messages; + /** + + * @var ?EventSubscriptionCollection + */ + private $events; + /** * @var null|DeliveryFormat|DeliveryFormatBuilder @@ -209,6 +215,17 @@ public function getMessages() return $this->messages; } + /** + *Events subscribed to.
+ * + + * @return null|EventSubscriptionCollection + */ + public function getEvents() + { + return $this->events; + } + /** *Format in which the payload is delivered.
* @@ -341,6 +358,17 @@ public function withMessages(?MessageSubscriptionCollection $messages) return $this; } + /** + * @param ?EventSubscriptionCollection $events + * @return $this + */ + public function withEvents(?EventSubscriptionCollection $events) + { + $this->events = $events; + + return $this; + } + /** * @param ?DeliveryFormat $format * @return $this @@ -420,6 +448,7 @@ public function build(): Subscription $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination, $this->key, $this->messages, + $this->events, $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format, $this->status ); diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionDraft.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionDraft.php index c897db009a9..1c99c445afd 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionDraft.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionDraft.php @@ -17,6 +17,7 @@ interface SubscriptionDraft extends JsonObject public const FIELD_DESTINATION = 'destination'; public const FIELD_KEY = 'key'; public const FIELD_MESSAGES = 'messages'; + public const FIELD_EVENTS = 'events'; public const FIELD_FORMAT = 'format'; /** @@ -51,6 +52,14 @@ public function getKey(); */ public function getMessages(); + /** + *Events to be subscribed to.
+ * + + * @return null|EventSubscriptionCollection + */ + public function getEvents(); + /** *Format in which the payload is delivered. When not provided, the PlatformFormat is selected by default.
* @@ -79,6 +88,11 @@ public function setKey(?string $key): void; */ public function setMessages(?MessageSubscriptionCollection $messages): void; + /** + * @param ?EventSubscriptionCollection $events + */ + public function setEvents(?EventSubscriptionCollection $events): void; + /** * @param ?DeliveryFormat $format */ diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftBuilder.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftBuilder.php index 036eeb94c9a..8281d94b662 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftBuilder.php @@ -44,6 +44,12 @@ final class SubscriptionDraftBuilder implements Builder */ private $messages; + /** + + * @var ?EventSubscriptionCollection + */ + private $events; + /** * @var null|DeliveryFormat|DeliveryFormatBuilder @@ -94,6 +100,17 @@ public function getMessages() return $this->messages; } + /** + *Events to be subscribed to.
+ * + + * @return null|EventSubscriptionCollection + */ + public function getEvents() + { + return $this->events; + } + /** *Format in which the payload is delivered. When not provided, the PlatformFormat is selected by default.
* @@ -149,6 +166,17 @@ public function withMessages(?MessageSubscriptionCollection $messages) return $this; } + /** + * @param ?EventSubscriptionCollection $events + * @return $this + */ + public function withEvents(?EventSubscriptionCollection $events) + { + $this->events = $events; + + return $this; + } + /** * @param ?DeliveryFormat $format * @return $this @@ -189,6 +217,7 @@ public function build(): SubscriptionDraft $this->destination instanceof DestinationBuilder ? $this->destination->build() : $this->destination, $this->key, $this->messages, + $this->events, $this->format instanceof DeliveryFormatBuilder ? $this->format->build() : $this->format ); } diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftModel.php index 3c85f870af4..c4d1ca19a4e 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftModel.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionDraftModel.php @@ -43,6 +43,12 @@ final class SubscriptionDraftModel extends JsonObjectModel implements Subscripti */ protected $messages; + /** + * + * @var ?EventSubscriptionCollection + */ + protected $events; + /** * * @var ?DeliveryFormat @@ -58,12 +64,14 @@ public function __construct( ?Destination $destination = null, ?string $key = null, ?MessageSubscriptionCollection $messages = null, + ?EventSubscriptionCollection $events = null, ?DeliveryFormat $format = null ) { $this->changes = $changes; $this->destination = $destination; $this->key = $key; $this->messages = $messages; + $this->events = $events; $this->format = $format; } @@ -148,6 +156,26 @@ public function getMessages() return $this->messages; } + /** + *Events to be subscribed to.
+ * + * + * @return null|EventSubscriptionCollection + */ + public function getEvents() + { + if (is_null($this->events)) { + /** @psalm-var ?listFormat in which the payload is delivered. When not provided, the PlatformFormat is selected by default.
* @@ -202,6 +230,14 @@ public function setMessages(?MessageSubscriptionCollection $messages): void $this->messages = $messages; } + /** + * @param ?EventSubscriptionCollection $events + */ + public function setEvents(?EventSubscriptionCollection $events): void + { + $this->events = $events; + } + /** * @param ?DeliveryFormat $format */ diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionModel.php index e32debf7884..57ec22ea2fa 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionModel.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionModel.php @@ -86,6 +86,12 @@ final class SubscriptionModel extends JsonObjectModel implements Subscription */ protected $messages; + /** + * + * @var ?EventSubscriptionCollection + */ + protected $events; + /** * * @var ?DeliveryFormat @@ -113,6 +119,7 @@ public function __construct( ?Destination $destination = null, ?string $key = null, ?MessageSubscriptionCollection $messages = null, + ?EventSubscriptionCollection $events = null, ?DeliveryFormat $format = null, ?string $status = null ) { @@ -126,6 +133,7 @@ public function __construct( $this->destination = $destination; $this->key = $key; $this->messages = $messages; + $this->events = $events; $this->format = $format; $this->status = $status; } @@ -341,6 +349,26 @@ public function getMessages() return $this->messages; } + /** + *Events subscribed to.
+ * + * + * @return null|EventSubscriptionCollection + */ + public function getEvents() + { + if (is_null($this->events)) { + /** @psalm-var ?listFormat in which the payload is delivered.
* @@ -463,6 +491,14 @@ public function setMessages(?MessageSubscriptionCollection $messages): void $this->messages = $messages; } + /** + * @param ?EventSubscriptionCollection $events + */ + public function setEvents(?EventSubscriptionCollection $events): void + { + $this->events = $events; + } + /** * @param ?DeliveryFormat $format */ diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionNotification.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotification.php new file mode 100644 index 00000000000..92fd8a1a337 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotification.php @@ -0,0 +1,26 @@ +Identifies the payload. + * + + * @return null|string + */ + public function getNotificationType(); +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationBuilder.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationBuilder.php new file mode 100644 index 00000000000..b11ea700718 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationBuilder.php @@ -0,0 +1,33 @@ + + */ +final class SubscriptionNotificationBuilder implements Builder +{ + public function build(): SubscriptionNotification + { + return new SubscriptionNotificationModel( + ); + } + + public static function of(): SubscriptionNotificationBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationCollection.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationCollection.php new file mode 100644 index 00000000000..f8215bc3b1c --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationCollection.php @@ -0,0 +1,60 @@ + + * @psalm-method T current() + * @psalm-method T end() + * @psalm-method T at($offset) + * @method SubscriptionNotification current() + * @method SubscriptionNotification end() + * @method SubscriptionNotification at($offset) + */ +class SubscriptionNotificationCollection extends MapperSequence +{ + /** + * @psalm-assert T $value + * @psalm-param T|stdClass $value + * @throws InvalidArgumentException + * + * @return SubscriptionNotificationCollection + */ + public function add($value) + { + if (!$value instanceof SubscriptionNotification) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?T + */ + protected function mapper() + { + return function (?int $index): ?SubscriptionNotification { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var T $data */ + $data = SubscriptionNotificationModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationModel.php new file mode 100644 index 00000000000..71ef8e55d64 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionNotificationModel.php @@ -0,0 +1,100 @@ + > + * + */ + private static $discriminatorClasses = [ + 'Event' => EventDeliveryPayloadModel::class, + 'Message' => MessageDeliveryPayloadModel::class, + 'ResourceCreated' => ResourceCreatedDeliveryPayloadModel::class, + 'ResourceDeleted' => ResourceDeletedDeliveryPayloadModel::class, + 'ResourceUpdated' => ResourceUpdatedDeliveryPayloadModel::class, + ]; + + /** + * @psalm-suppress MissingParamType + */ + public function __construct( + ?string $notificationType = null + ) { + $this->notificationType = $notificationType; + } + + /** + *Identifies the payload.
+ * + * + * @return null|string + */ + public function getNotificationType() + { + if (is_null($this->notificationType)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + if (is_null($data)) { + return null; + } + $this->notificationType = (string) $data; + } + + return $this->notificationType; + } + + + + + + /** + * @psalm-param stdClass|arrayValue to set. Can only be unset if messages is set.
Value to set. Can only be unset if either messages or events is set.
Value to set. Can only be unset if messages is set.
Value to set. Can only be unset if either messages or events is set.
Value to set. Can only be unset if messages is set.
Value to set. Can only be unset if either messages or events is set.
messages or changes is set.
+ *
+
+ * @return null|EventSubscriptionCollection
+ */
+ public function getMessages();
+
+ /**
+ * @param ?EventSubscriptionCollection $messages
+ */
+ public function setMessages(?EventSubscriptionCollection $messages): void;
+}
diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionBuilder.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionBuilder.php
new file mode 100644
index 00000000000..3ca9e2bea1f
--- /dev/null
+++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionBuilder.php
@@ -0,0 +1,63 @@
+
+ */
+final class SubscriptionSetEventsActionBuilder implements Builder
+{
+ /**
+
+ * @var ?EventSubscriptionCollection
+ */
+ private $messages;
+
+ /**
+ * Value to set. Can only be unset if either messages or changes is set.
Value to set. Can only be unset if either messages or changes is set.
Value to set. Can only be unset if changes is set.
Value to set. Can only be unset if either changes or events is set.
Value to set. Can only be unset if changes is set.
Value to set. Can only be unset if either changes or events is set.
Value to set. Can only be unset if changes is set.
Value to set. Can only be unset if either changes or events is set.