diff --git a/changes.md b/changes.md index dbc7583b3d6..6b3bca11eba 100644 --- a/changes.md +++ b/changes.md @@ -14,6 +14,75 @@ +
+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`
@@ -82,43 +153,6 @@ -
-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'; /** - *

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 inheritedAssociates and inheritedStores field values will be eventually consistent.

* * @return null|BusinessUnitResourceIdentifier diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionBuilder.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionBuilder.php index 0938f0ac705..86e4dac166e 100644 --- a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionBuilder.php +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionBuilder.php @@ -27,7 +27,9 @@ final class BusinessUnitChangeParentUnitActionBuilder implements Builder private $parentUnit; /** - *

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 inheritedAssociates and inheritedStores field values will be eventually consistent.

* * @return null|BusinessUnitResourceIdentifier diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionModel.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionModel.php index b09981dfe1f..2633e39fb5b 100644 --- a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionModel.php +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitChangeParentUnitActionModel.php @@ -63,7 +63,9 @@ public function getAction() } /** - *

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 inheritedAssociates and inheritedStores field values will be eventually consistent.

* * * @return null|BusinessUnitResourceIdentifier diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeAction.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeAction.php new file mode 100644 index 00000000000..a023c85784a --- /dev/null +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeAction.php @@ -0,0 +1,45 @@ +New type of the Business Unit.

+ *

If unitType="Company", the Business Unit storeMode, associateMode, and approvalRuleMode field values must be Explicit.

+ * + + * @return null|string + */ + public function getUnitType(); + + /** + *

New parent unit for the Business Unit, if unitType="Division".

+ * + + * @return null|BusinessUnitResourceIdentifier + */ + public function getParentUnit(); + + /** + * @param ?string $unitType + */ + public function setUnitType(?string $unitType): void; + + /** + * @param ?BusinessUnitResourceIdentifier $parentUnit + */ + public function setParentUnit(?BusinessUnitResourceIdentifier $parentUnit): void; +} diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionBuilder.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionBuilder.php new file mode 100644 index 00000000000..52d3b79aca4 --- /dev/null +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionBuilder.php @@ -0,0 +1,103 @@ + + */ +final class BusinessUnitSetUnitTypeActionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $unitType; + + /** + + * @var null|BusinessUnitResourceIdentifier|BusinessUnitResourceIdentifierBuilder + */ + private $parentUnit; + + /** + *

New type of the Business Unit.

+ *

If unitType="Company", the Business Unit storeMode, associateMode, and approvalRuleMode field values must be Explicit.

+ * + + * @return null|string + */ + public function getUnitType() + { + return $this->unitType; + } + + /** + *

New parent unit for the Business Unit, if unitType="Division".

+ * + + * @return null|BusinessUnitResourceIdentifier + */ + public function getParentUnit() + { + return $this->parentUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->parentUnit->build() : $this->parentUnit; + } + + /** + * @param ?string $unitType + * @return $this + */ + public function withUnitType(?string $unitType) + { + $this->unitType = $unitType; + + return $this; + } + + /** + * @param ?BusinessUnitResourceIdentifier $parentUnit + * @return $this + */ + public function withParentUnit(?BusinessUnitResourceIdentifier $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + /** + * @deprecated use withParentUnit() instead + * @return $this + */ + public function withParentUnitBuilder(?BusinessUnitResourceIdentifierBuilder $parentUnit) + { + $this->parentUnit = $parentUnit; + + return $this; + } + + public function build(): BusinessUnitSetUnitTypeAction + { + return new BusinessUnitSetUnitTypeActionModel( + $this->unitType, + $this->parentUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->parentUnit->build() : $this->parentUnit + ); + } + + public static function of(): BusinessUnitSetUnitTypeActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionCollection.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionCollection.php new file mode 100644 index 00000000000..ce8c9753bc6 --- /dev/null +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionCollection.php @@ -0,0 +1,56 @@ + + * @method BusinessUnitSetUnitTypeAction current() + * @method BusinessUnitSetUnitTypeAction end() + * @method BusinessUnitSetUnitTypeAction at($offset) + */ +class BusinessUnitSetUnitTypeActionCollection extends BusinessUnitUpdateActionCollection +{ + /** + * @psalm-assert BusinessUnitSetUnitTypeAction $value + * @psalm-param BusinessUnitSetUnitTypeAction|stdClass $value + * @throws InvalidArgumentException + * + * @return BusinessUnitSetUnitTypeActionCollection + */ + public function add($value) + { + if (!$value instanceof BusinessUnitSetUnitTypeAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?BusinessUnitSetUnitTypeAction + */ + protected function mapper() + { + return function (?int $index): ?BusinessUnitSetUnitTypeAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var BusinessUnitSetUnitTypeAction $data */ + $data = BusinessUnitSetUnitTypeActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionModel.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionModel.php new file mode 100644 index 00000000000..677990c5ead --- /dev/null +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitSetUnitTypeActionModel.php @@ -0,0 +1,131 @@ +unitType = $unitType; + $this->parentUnit = $parentUnit; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *

New type of the Business Unit.

+ *

If unitType="Company", the Business Unit storeMode, associateMode, and approvalRuleMode field values must be Explicit.

+ * + * + * @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; + } + + /** + *

New parent unit for the Business Unit, if unitType="Division".

+ * + * + * @return null|BusinessUnitResourceIdentifier + */ + public function getParentUnit() + { + if (is_null($this->parentUnit)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_PARENT_UNIT); + if (is_null($data)) { + return null; + } + + $this->parentUnit = BusinessUnitResourceIdentifierModel::of($data); + } + + return $this->parentUnit; + } + + + /** + * @param ?string $unitType + */ + public function setUnitType(?string $unitType): void + { + $this->unitType = $unitType; + } + + /** + * @param ?BusinessUnitResourceIdentifier $parentUnit + */ + public function setParentUnit(?BusinessUnitResourceIdentifier $parentUnit): void + { + $this->parentUnit = $parentUnit; + } +} diff --git a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitUpdateActionModel.php b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitUpdateActionModel.php index 7b8c8c60fd6..78649c93a92 100644 --- a/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitUpdateActionModel.php +++ b/lib/commercetools-api/src/Models/BusinessUnit/BusinessUnitUpdateActionModel.php @@ -58,6 +58,7 @@ final class BusinessUnitUpdateActionModel extends JsonObjectModel implements Bus 'setDefaultShippingAddress' => BusinessUnitSetDefaultShippingAddressActionModel::class, 'setStoreMode' => BusinessUnitSetStoreModeActionModel::class, 'setStores' => BusinessUnitSetStoresActionModel::class, + 'setUnitType' => BusinessUnitSetUnitTypeActionModel::class, ]; /** diff --git a/lib/commercetools-api/src/Models/Cart/CartDraft.php b/lib/commercetools-api/src/Models/Cart/CartDraft.php index 9e1035cb5ba..e5f61439ef0 100644 --- a/lib/commercetools-api/src/Models/Cart/CartDraft.php +++ b/lib/commercetools-api/src/Models/Cart/CartDraft.php @@ -84,8 +84,8 @@ public function getCustomerEmail(); /** *

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.

* * @return null|CustomerGroupResourceIdentifier diff --git a/lib/commercetools-api/src/Models/Cart/CartDraftBuilder.php b/lib/commercetools-api/src/Models/Cart/CartDraftBuilder.php index c9ace8bd131..07656a122ab 100644 --- a/lib/commercetools-api/src/Models/Cart/CartDraftBuilder.php +++ b/lib/commercetools-api/src/Models/Cart/CartDraftBuilder.php @@ -253,8 +253,8 @@ public function getCustomerEmail() /** *

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.

* * @return null|CustomerGroupResourceIdentifier diff --git a/lib/commercetools-api/src/Models/Cart/CartDraftModel.php b/lib/commercetools-api/src/Models/Cart/CartDraftModel.php index 5f226b1a312..307b0d2dc83 100644 --- a/lib/commercetools-api/src/Models/Cart/CartDraftModel.php +++ b/lib/commercetools-api/src/Models/Cart/CartDraftModel.php @@ -354,8 +354,8 @@ public function getCustomerEmail() /** *

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.

* * * @return null|CustomerGroupResourceIdentifier diff --git a/lib/commercetools-api/src/Models/Common/BaseResource.php b/lib/commercetools-api/src/Models/Common/BaseResource.php index fc499df0c40..c0f9b1b7468 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResource.php +++ b/lib/commercetools-api/src/Models/Common/BaseResource.php @@ -79,6 +79,8 @@ use Commercetools\Api\Models\Message\BusinessUnitStoreModeChangedMessage; use Commercetools\Api\Models\Message\BusinessUnitStoreRemovedMessage; use Commercetools\Api\Models\Message\BusinessUnitStoresSetMessage; +use Commercetools\Api\Models\Message\BusinessUnitTopLevelUnitSetMessage; +use Commercetools\Api\Models\Message\BusinessUnitTypeSetMessage; use Commercetools\Api\Models\Message\CartDiscountCreatedMessage; use Commercetools\Api\Models\Message\CartDiscountDeletedMessage; use Commercetools\Api\Models\Message\CartDiscountStoreAddedMessage; diff --git a/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php b/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php index f90d9c75ab1..6477e441a8a 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php +++ b/lib/commercetools-api/src/Models/Common/BaseResourceBuilder.php @@ -150,6 +150,10 @@ use Commercetools\Api\Models\Message\BusinessUnitStoreRemovedMessageBuilder; use Commercetools\Api\Models\Message\BusinessUnitStoresSetMessage; use Commercetools\Api\Models\Message\BusinessUnitStoresSetMessageBuilder; +use Commercetools\Api\Models\Message\BusinessUnitTopLevelUnitSetMessage; +use Commercetools\Api\Models\Message\BusinessUnitTopLevelUnitSetMessageBuilder; +use Commercetools\Api\Models\Message\BusinessUnitTypeSetMessage; +use Commercetools\Api\Models\Message\BusinessUnitTypeSetMessageBuilder; use Commercetools\Api\Models\Message\CartDiscountCreatedMessage; use Commercetools\Api\Models\Message\CartDiscountCreatedMessageBuilder; use Commercetools\Api\Models\Message\CartDiscountDeletedMessage; diff --git a/lib/commercetools-api/src/Models/Common/BaseResourceModel.php b/lib/commercetools-api/src/Models/Common/BaseResourceModel.php index e736aa14af5..11cecd1f8fe 100644 --- a/lib/commercetools-api/src/Models/Common/BaseResourceModel.php +++ b/lib/commercetools-api/src/Models/Common/BaseResourceModel.php @@ -150,6 +150,10 @@ use Commercetools\Api\Models\Message\BusinessUnitStoreRemovedMessageModel; use Commercetools\Api\Models\Message\BusinessUnitStoresSetMessage; use Commercetools\Api\Models\Message\BusinessUnitStoresSetMessageModel; +use Commercetools\Api\Models\Message\BusinessUnitTopLevelUnitSetMessage; +use Commercetools\Api\Models\Message\BusinessUnitTopLevelUnitSetMessageModel; +use Commercetools\Api\Models\Message\BusinessUnitTypeSetMessage; +use Commercetools\Api\Models\Message\BusinessUnitTypeSetMessageModel; use Commercetools\Api\Models\Message\CartDiscountCreatedMessage; use Commercetools\Api\Models\Message\CartDiscountCreatedMessageModel; use Commercetools\Api\Models\Message\CartDiscountDeletedMessage; diff --git a/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionError.php b/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionError.php index 8c4386866bf..f04290c64ad 100644 --- a/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionError.php +++ b/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionError.php @@ -29,7 +29,7 @@ public function getCode(); /** * * diff --git a/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorBuilder.php b/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorBuilder.php index 7078d5aba73..e60aa95df6d 100644 --- a/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorBuilder.php +++ b/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorBuilder.php @@ -57,7 +57,7 @@ final class AssociateMissingPermissionErrorBuilder implements Builder /** * * diff --git a/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorModel.php b/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorModel.php index 57a10bb4e9e..7fe2847d5f6 100644 --- a/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorModel.php +++ b/lib/commercetools-api/src/Models/Error/AssociateMissingPermissionErrorModel.php @@ -101,7 +101,7 @@ public function getCode() /** * * diff --git a/lib/commercetools-api/src/Models/Event/BaseEvent.php b/lib/commercetools-api/src/Models/Event/BaseEvent.php new file mode 100644 index 00000000000..2e477b663fd --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/BaseEvent.php @@ -0,0 +1,99 @@ +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(); + + /** + *

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

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 ?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|array $value + * @psalm-return class-string + */ + public static function resolveDiscriminatorClass($value): string + { + $fieldName = Event::DISCRIMINATOR_FIELD; + if (is_object($value) && isset($value->$fieldName)) { + /** @psalm-var string $discriminatorValue */ + $discriminatorValue = $value->$fieldName; + if (isset(self::$discriminatorClasses[$discriminatorValue])) { + return self::$discriminatorClasses[$discriminatorValue]; + } + } + if (is_array($value) && isset($value[$fieldName])) { + /** @psalm-var string $discriminatorValue */ + $discriminatorValue = $value[$fieldName]; + if (isset(self::$discriminatorClasses[$discriminatorValue])) { + return self::$discriminatorClasses[$discriminatorValue]; + } + } + + /** @psalm-var class-string */ + $type = EventModel::class; + return $type; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEvent.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEvent.php new file mode 100644 index 00000000000..652150ef194 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEvent.php @@ -0,0 +1,41 @@ +An object containing details of the created Import Container.

+ * + + * @return null|ImportContainerCreatedEventData + */ + public function getData(); + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void; + + /** + * @param ?ImportContainerCreatedEventData $data + */ + public function setData(?ImportContainerCreatedEventData $data): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventBuilder.php b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventBuilder.php new file mode 100644 index 00000000000..2353a1bd213 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerCreatedEventBuilder.php @@ -0,0 +1,186 @@ + + */ +final class ImportContainerCreatedEventBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?string + */ + private $notificationType; + + /** + + * @var ?string + */ + private $resourceType; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var null|ImportContainerCreatedEventData|ImportContainerCreatedEventDataBuilder + */ + 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 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 @@ +The key of the created Import Container.

+ * + + * @return null|string + */ + public function getKey(); + + /** + *

The version of the created Import Container.

+ * + + * @return null|int + */ + public function getVersion(); + + /** + *

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.

+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *

The version of the created Import Container.

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

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.

+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + /** + *

The version of the created Import Container.

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

Date and time (UTC) the 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|array|null $data */ + $data = $this->raw(self::FIELD_DATA); + if (is_null($data)) { + return null; + } + + $this->data = ImportContainerCreatedEventDataModel::of($data); + } + + return $this->data; + } + + + /** + * @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; + } + + /** + * @param ?ImportContainerCreatedEventData $data + */ + public function setData(?ImportContainerCreatedEventData $data): void + { + $this->data = $data; + } + + + #[\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; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEvent.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEvent.php new file mode 100644 index 00000000000..279dec30107 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEvent.php @@ -0,0 +1,41 @@ +An object containing details of the deleted Import Container.

+ * + + * @return null|ImportContainerDeletedEventData + */ + public function getData(); + + /** + * @param ?string $resourceType + */ + public function setResourceType(?string $resourceType): void; + + /** + * @param ?ImportContainerDeletedEventData $data + */ + public function setData(?ImportContainerDeletedEventData $data): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventBuilder.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventBuilder.php new file mode 100644 index 00000000000..0366bb7d719 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventBuilder.php @@ -0,0 +1,186 @@ + + */ +final class ImportContainerDeletedEventBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?string + */ + private $notificationType; + + /** + + * @var ?string + */ + private $resourceType; + + /** + + * @var ?DateTimeImmutable + */ + private $createdAt; + + /** + + * @var null|ImportContainerDeletedEventData|ImportContainerDeletedEventDataBuilder + */ + 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 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 @@ +The key of the deleted Import Container.

+ * + + * @return null|string + */ + public function getKey(); + + /** + *

The version of the deleted Import Container.

+ * + + * @return null|int + */ + public function getVersion(); + + /** + * @param ?string $key + */ + public function setKey(?string $key): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataBuilder.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataBuilder.php new file mode 100644 index 00000000000..b6588d27f0b --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataBuilder.php @@ -0,0 +1,92 @@ + + */ +final class ImportContainerDeletedEventDataBuilder implements Builder +{ + /** + + * @var ?string + */ + private $key; + + /** + + * @var ?int + */ + private $version; + + /** + *

The key of the deleted Import Container.

+ * + + * @return null|string + */ + public function getKey() + { + return $this->key; + } + + /** + *

The version of the deleted Import Container.

+ * + + * @return null|int + */ + public function getVersion() + { + return $this->version; + } + + /** + * @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; + } + + + public function build(): ImportContainerDeletedEventData + { + return new ImportContainerDeletedEventDataModel( + $this->key, + $this->version + ); + } + + public static function of(): ImportContainerDeletedEventDataBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataCollection.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataCollection.php new file mode 100644 index 00000000000..bcaccb0d423 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataCollection.php @@ -0,0 +1,56 @@ + + * @method ImportContainerDeletedEventData current() + * @method ImportContainerDeletedEventData end() + * @method ImportContainerDeletedEventData at($offset) + */ +class ImportContainerDeletedEventDataCollection extends MapperSequence +{ + /** + * @psalm-assert ImportContainerDeletedEventData $value + * @psalm-param ImportContainerDeletedEventData|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportContainerDeletedEventDataCollection + */ + public function add($value) + { + if (!$value instanceof ImportContainerDeletedEventData) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportContainerDeletedEventData + */ + protected function mapper() + { + return function (?int $index): ?ImportContainerDeletedEventData { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportContainerDeletedEventData $data */ + $data = ImportContainerDeletedEventDataModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataModel.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataModel.php new file mode 100644 index 00000000000..c45aa70a892 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventDataModel.php @@ -0,0 +1,102 @@ +key = $key; + $this->version = $version; + } + + /** + *

The key of the deleted Import Container.

+ * + * + * @return null|string + */ + public function getKey() + { + if (is_null($this->key)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_KEY); + if (is_null($data)) { + return null; + } + $this->key = (string) $data; + } + + return $this->key; + } + + /** + *

The version of the deleted Import Container.

+ * + * + * @return null|int + */ + public function getVersion() + { + if (is_null($this->version)) { + /** @psalm-var ?int $data */ + $data = $this->raw(self::FIELD_VERSION); + if (is_null($data)) { + return null; + } + $this->version = (int) $data; + } + + return $this->version; + } + + + /** + * @param ?string $key + */ + public function setKey(?string $key): void + { + $this->key = $key; + } + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void + { + $this->version = $version; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventModel.php b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventModel.php new file mode 100644 index 00000000000..db10b953699 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportContainerDeletedEventModel.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 deleted Import Container.

+ * + * + * @return null|ImportContainerDeletedEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_DATA); + if (is_null($data)) { + return null; + } + + $this->data = ImportContainerDeletedEventDataModel::of($data); + } + + return $this->data; + } + + + /** + * @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; + } + + /** + * @param ?ImportContainerDeletedEventData $data + */ + public function setData(?ImportContainerDeletedEventData $data): void + { + $this->data = $data; + } + + + #[\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; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEvent.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEvent.php new file mode 100644 index 00000000000..d4836bbac76 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEvent.php @@ -0,0 +1,41 @@ +An object containing details of the Import Operation with the rejected 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.

+ * + + * @return null|ImportOperationRejectedEventData + */ + public function getData() + { + return $this->data instanceof ImportOperationRejectedEventDataBuilder ? $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 ?ImportOperationRejectedEventData $data + * @return $this + */ + public function withData(?ImportOperationRejectedEventData $data) + { + $this->data = $data; + + return $this; + } + + /** + * @deprecated use withData() instead + * @return $this + */ + public function withDataBuilder(?ImportOperationRejectedEventDataBuilder $data) + { + $this->data = $data; + + return $this; + } + + public function build(): ImportOperationRejectedEvent + { + return new ImportOperationRejectedEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt, + $this->data instanceof ImportOperationRejectedEventDataBuilder ? $this->data->build() : $this->data + ); + } + + public static function of(): ImportOperationRejectedEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventCollection.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventCollection.php new file mode 100644 index 00000000000..b56434a1b0a --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventCollection.php @@ -0,0 +1,56 @@ + + * @method ImportOperationRejectedEvent current() + * @method ImportOperationRejectedEvent end() + * @method ImportOperationRejectedEvent at($offset) + */ +class ImportOperationRejectedEventCollection extends EventCollection +{ + /** + * @psalm-assert ImportOperationRejectedEvent $value + * @psalm-param ImportOperationRejectedEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportOperationRejectedEventCollection + */ + public function add($value) + { + if (!$value instanceof ImportOperationRejectedEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportOperationRejectedEvent + */ + protected function mapper() + { + return function (?int $index): ?ImportOperationRejectedEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportOperationRejectedEvent $data */ + $data = ImportOperationRejectedEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventData.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventData.php new file mode 100644 index 00000000000..402fef7d745 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventData.php @@ -0,0 +1,30 @@ +The 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.

+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + * @param ?string $id + * @return $this + */ + public function withId(?string $id) + { + $this->id = $id; + + return $this; + } + + + public function build(): ImportOperationRejectedEventData + { + return new ImportOperationRejectedEventDataModel( + $this->id + ); + } + + public static function of(): ImportOperationRejectedEventDataBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataCollection.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataCollection.php new file mode 100644 index 00000000000..cb8106f8cf6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataCollection.php @@ -0,0 +1,56 @@ + + * @method ImportOperationRejectedEventData current() + * @method ImportOperationRejectedEventData end() + * @method ImportOperationRejectedEventData at($offset) + */ +class ImportOperationRejectedEventDataCollection extends MapperSequence +{ + /** + * @psalm-assert ImportOperationRejectedEventData $value + * @psalm-param ImportOperationRejectedEventData|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportOperationRejectedEventDataCollection + */ + public function add($value) + { + if (!$value instanceof ImportOperationRejectedEventData) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportOperationRejectedEventData + */ + protected function mapper() + { + return function (?int $index): ?ImportOperationRejectedEventData { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportOperationRejectedEventData $data */ + $data = ImportOperationRejectedEventDataModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataModel.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataModel.php new file mode 100644 index 00000000000..67037b0186c --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventDataModel.php @@ -0,0 +1,66 @@ +id = $id; + } + + /** + *

The id of the Import Operation with the rejected state.

+ * + * + * @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; + } + + + /** + * @param ?string $id + */ + public function setId(?string $id): void + { + $this->id = $id; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventModel.php b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventModel.php new file mode 100644 index 00000000000..4f3b89ad2c3 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportOperationRejectedEventModel.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 Import Operation with the rejected state.

+ * + * + * @return null|ImportOperationRejectedEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_DATA); + if (is_null($data)) { + return null; + } + + $this->data = ImportOperationRejectedEventDataModel::of($data); + } + + return $this->data; + } + + + /** + * @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; + } + + /** + * @param ?ImportOperationRejectedEventData $data + */ + public function setData(?ImportOperationRejectedEventData $data): void + { + $this->data = $data; + } + + + #[\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; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEvent.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEvent.php new file mode 100644 index 00000000000..02dfa00d820 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEvent.php @@ -0,0 +1,41 @@ +An object containing details of the Import Operation with the 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.

+ * + + * @return null|ImportUnresolvedEventData + */ + public function getData() + { + return $this->data instanceof ImportUnresolvedEventDataBuilder ? $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 ?ImportUnresolvedEventData $data + * @return $this + */ + public function withData(?ImportUnresolvedEventData $data) + { + $this->data = $data; + + return $this; + } + + /** + * @deprecated use withData() instead + * @return $this + */ + public function withDataBuilder(?ImportUnresolvedEventDataBuilder $data) + { + $this->data = $data; + + return $this; + } + + public function build(): ImportUnresolvedEvent + { + return new ImportUnresolvedEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt, + $this->data instanceof ImportUnresolvedEventDataBuilder ? $this->data->build() : $this->data + ); + } + + public static function of(): ImportUnresolvedEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventCollection.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventCollection.php new file mode 100644 index 00000000000..c9049f67648 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventCollection.php @@ -0,0 +1,56 @@ + + * @method ImportUnresolvedEvent current() + * @method ImportUnresolvedEvent end() + * @method ImportUnresolvedEvent at($offset) + */ +class ImportUnresolvedEventCollection extends EventCollection +{ + /** + * @psalm-assert ImportUnresolvedEvent $value + * @psalm-param ImportUnresolvedEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportUnresolvedEventCollection + */ + public function add($value) + { + if (!$value instanceof ImportUnresolvedEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportUnresolvedEvent + */ + protected function mapper() + { + return function (?int $index): ?ImportUnresolvedEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportUnresolvedEvent $data */ + $data = ImportUnresolvedEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventData.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventData.php new file mode 100644 index 00000000000..bf759cd6cf0 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventData.php @@ -0,0 +1,58 @@ +The 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.

+ * + + * @return null|int + */ + public function getVersion(); + + /** + *

The key of the Import Container.

+ * + + * @return null|string + */ + public function getImportContainerKey(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?string $importContainerKey + */ + public function setImportContainerKey(?string $importContainerKey): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataBuilder.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataBuilder.php new file mode 100644 index 00000000000..6fef20a98c9 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataBuilder.php @@ -0,0 +1,121 @@ + + */ +final class ImportUnresolvedEventDataBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?string + */ + private $importContainerKey; + + /** + *

The id of the Import Operation with the unresolved state.

+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *

The version of the Import Operation with the unresolved state.

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

The key of the Import Container.

+ * + + * @return null|string + */ + public function getImportContainerKey() + { + return $this->importContainerKey; + } + + /** + * @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 ?string $importContainerKey + * @return $this + */ + public function withImportContainerKey(?string $importContainerKey) + { + $this->importContainerKey = $importContainerKey; + + return $this; + } + + + public function build(): ImportUnresolvedEventData + { + return new ImportUnresolvedEventDataModel( + $this->id, + $this->version, + $this->importContainerKey + ); + } + + public static function of(): ImportUnresolvedEventDataBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataCollection.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataCollection.php new file mode 100644 index 00000000000..8cb82e4c919 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataCollection.php @@ -0,0 +1,56 @@ + + * @method ImportUnresolvedEventData current() + * @method ImportUnresolvedEventData end() + * @method ImportUnresolvedEventData at($offset) + */ +class ImportUnresolvedEventDataCollection extends MapperSequence +{ + /** + * @psalm-assert ImportUnresolvedEventData $value + * @psalm-param ImportUnresolvedEventData|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportUnresolvedEventDataCollection + */ + public function add($value) + { + if (!$value instanceof ImportUnresolvedEventData) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportUnresolvedEventData + */ + protected function mapper() + { + return function (?int $index): ?ImportUnresolvedEventData { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportUnresolvedEventData $data */ + $data = ImportUnresolvedEventDataModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataModel.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataModel.php new file mode 100644 index 00000000000..326a4e1dac2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventDataModel.php @@ -0,0 +1,138 @@ +id = $id; + $this->version = $version; + $this->importContainerKey = $importContainerKey; + } + + /** + *

The id of the Import Operation with the unresolved state.

+ * + * + * @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 version of the Import Operation with the unresolved state.

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

The key of the Import Container.

+ * + * + * @return null|string + */ + public function getImportContainerKey() + { + if (is_null($this->importContainerKey)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_IMPORT_CONTAINER_KEY); + if (is_null($data)) { + return null; + } + $this->importContainerKey = (string) $data; + } + + return $this->importContainerKey; + } + + + /** + * @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 ?string $importContainerKey + */ + public function setImportContainerKey(?string $importContainerKey): void + { + $this->importContainerKey = $importContainerKey; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventModel.php b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventModel.php new file mode 100644 index 00000000000..313bf6a68dc --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportUnresolvedEventModel.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 Import Operation with the unresolved state.

+ * + * + * @return null|ImportUnresolvedEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_DATA); + if (is_null($data)) { + return null; + } + + $this->data = ImportUnresolvedEventDataModel::of($data); + } + + return $this->data; + } + + + /** + * @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; + } + + /** + * @param ?ImportUnresolvedEventData $data + */ + public function setData(?ImportUnresolvedEventData $data): void + { + $this->data = $data; + } + + + #[\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; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEvent.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEvent.php new file mode 100644 index 00000000000..1acd5919360 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEvent.php @@ -0,0 +1,41 @@ +An object containing details of the Import Operation with the 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.

+ * + + * @return null|ImportValidationFailedEventData + */ + public function getData() + { + return $this->data instanceof ImportValidationFailedEventDataBuilder ? $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 ?ImportValidationFailedEventData $data + * @return $this + */ + public function withData(?ImportValidationFailedEventData $data) + { + $this->data = $data; + + return $this; + } + + /** + * @deprecated use withData() instead + * @return $this + */ + public function withDataBuilder(?ImportValidationFailedEventDataBuilder $data) + { + $this->data = $data; + + return $this; + } + + public function build(): ImportValidationFailedEvent + { + return new ImportValidationFailedEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt, + $this->data instanceof ImportValidationFailedEventDataBuilder ? $this->data->build() : $this->data + ); + } + + public static function of(): ImportValidationFailedEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventCollection.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventCollection.php new file mode 100644 index 00000000000..46c65b7e63f --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventCollection.php @@ -0,0 +1,56 @@ + + * @method ImportValidationFailedEvent current() + * @method ImportValidationFailedEvent end() + * @method ImportValidationFailedEvent at($offset) + */ +class ImportValidationFailedEventCollection extends EventCollection +{ + /** + * @psalm-assert ImportValidationFailedEvent $value + * @psalm-param ImportValidationFailedEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportValidationFailedEventCollection + */ + public function add($value) + { + if (!$value instanceof ImportValidationFailedEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportValidationFailedEvent + */ + protected function mapper() + { + return function (?int $index): ?ImportValidationFailedEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportValidationFailedEvent $data */ + $data = ImportValidationFailedEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventData.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventData.php new file mode 100644 index 00000000000..88f48eb8210 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventData.php @@ -0,0 +1,58 @@ +The 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.

+ * + + * @return null|int + */ + public function getVersion(); + + /** + *

The key of the Import Container.

+ * + + * @return null|string + */ + public function getImportContainerKey(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?string $importContainerKey + */ + public function setImportContainerKey(?string $importContainerKey): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataBuilder.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataBuilder.php new file mode 100644 index 00000000000..774a787e743 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataBuilder.php @@ -0,0 +1,121 @@ + + */ +final class ImportValidationFailedEventDataBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?string + */ + private $importContainerKey; + + /** + *

The id of the Import Operation with the validationFailed state.

+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *

The version of the Import Operation with the validationFailed state.

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

The key of the Import Container.

+ * + + * @return null|string + */ + public function getImportContainerKey() + { + return $this->importContainerKey; + } + + /** + * @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 ?string $importContainerKey + * @return $this + */ + public function withImportContainerKey(?string $importContainerKey) + { + $this->importContainerKey = $importContainerKey; + + return $this; + } + + + public function build(): ImportValidationFailedEventData + { + return new ImportValidationFailedEventDataModel( + $this->id, + $this->version, + $this->importContainerKey + ); + } + + public static function of(): ImportValidationFailedEventDataBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataCollection.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataCollection.php new file mode 100644 index 00000000000..0551d21ecf6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataCollection.php @@ -0,0 +1,56 @@ + + * @method ImportValidationFailedEventData current() + * @method ImportValidationFailedEventData end() + * @method ImportValidationFailedEventData at($offset) + */ +class ImportValidationFailedEventDataCollection extends MapperSequence +{ + /** + * @psalm-assert ImportValidationFailedEventData $value + * @psalm-param ImportValidationFailedEventData|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportValidationFailedEventDataCollection + */ + public function add($value) + { + if (!$value instanceof ImportValidationFailedEventData) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportValidationFailedEventData + */ + protected function mapper() + { + return function (?int $index): ?ImportValidationFailedEventData { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportValidationFailedEventData $data */ + $data = ImportValidationFailedEventDataModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataModel.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataModel.php new file mode 100644 index 00000000000..445e3d272c4 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventDataModel.php @@ -0,0 +1,138 @@ +id = $id; + $this->version = $version; + $this->importContainerKey = $importContainerKey; + } + + /** + *

The id of the Import Operation with the validationFailed state.

+ * + * + * @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 version of the Import Operation with the validationFailed state.

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

The key of the Import Container.

+ * + * + * @return null|string + */ + public function getImportContainerKey() + { + if (is_null($this->importContainerKey)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_IMPORT_CONTAINER_KEY); + if (is_null($data)) { + return null; + } + $this->importContainerKey = (string) $data; + } + + return $this->importContainerKey; + } + + + /** + * @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 ?string $importContainerKey + */ + public function setImportContainerKey(?string $importContainerKey): void + { + $this->importContainerKey = $importContainerKey; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventModel.php b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventModel.php new file mode 100644 index 00000000000..c71df384898 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportValidationFailedEventModel.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 Import Operation with the validationFailed state.

+ * + * + * @return null|ImportValidationFailedEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_DATA); + if (is_null($data)) { + return null; + } + + $this->data = ImportValidationFailedEventDataModel::of($data); + } + + return $this->data; + } + + + /** + * @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; + } + + /** + * @param ?ImportValidationFailedEventData $data + */ + public function setData(?ImportValidationFailedEventData $data): void + { + $this->data = $data; + } + + + #[\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; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEvent.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEvent.php new file mode 100644 index 00000000000..8713550643e --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEvent.php @@ -0,0 +1,41 @@ +An object containing details of the Import Operation with the 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.

+ * + + * @return null|ImportWaitForMasterVariantEventData + */ + public function getData() + { + return $this->data instanceof ImportWaitForMasterVariantEventDataBuilder ? $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 ?ImportWaitForMasterVariantEventData $data + * @return $this + */ + public function withData(?ImportWaitForMasterVariantEventData $data) + { + $this->data = $data; + + return $this; + } + + /** + * @deprecated use withData() instead + * @return $this + */ + public function withDataBuilder(?ImportWaitForMasterVariantEventDataBuilder $data) + { + $this->data = $data; + + return $this; + } + + public function build(): ImportWaitForMasterVariantEvent + { + return new ImportWaitForMasterVariantEventModel( + $this->id, + $this->notificationType, + $this->resourceType, + $this->createdAt, + $this->data instanceof ImportWaitForMasterVariantEventDataBuilder ? $this->data->build() : $this->data + ); + } + + public static function of(): ImportWaitForMasterVariantEventBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventCollection.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventCollection.php new file mode 100644 index 00000000000..2ab1c8cca87 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventCollection.php @@ -0,0 +1,56 @@ + + * @method ImportWaitForMasterVariantEvent current() + * @method ImportWaitForMasterVariantEvent end() + * @method ImportWaitForMasterVariantEvent at($offset) + */ +class ImportWaitForMasterVariantEventCollection extends EventCollection +{ + /** + * @psalm-assert ImportWaitForMasterVariantEvent $value + * @psalm-param ImportWaitForMasterVariantEvent|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportWaitForMasterVariantEventCollection + */ + public function add($value) + { + if (!$value instanceof ImportWaitForMasterVariantEvent) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportWaitForMasterVariantEvent + */ + protected function mapper() + { + return function (?int $index): ?ImportWaitForMasterVariantEvent { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportWaitForMasterVariantEvent $data */ + $data = ImportWaitForMasterVariantEventModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventData.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventData.php new file mode 100644 index 00000000000..3e98e7d819d --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventData.php @@ -0,0 +1,58 @@ +The 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.

+ * + + * @return null|int + */ + public function getVersion(); + + /** + *

The key of the Import Container.

+ * + + * @return null|string + */ + public function getImportContainerKey(); + + /** + * @param ?string $id + */ + public function setId(?string $id): void; + + /** + * @param ?int $version + */ + public function setVersion(?int $version): void; + + /** + * @param ?string $importContainerKey + */ + public function setImportContainerKey(?string $importContainerKey): void; +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataBuilder.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataBuilder.php new file mode 100644 index 00000000000..5faf545586a --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataBuilder.php @@ -0,0 +1,121 @@ + + */ +final class ImportWaitForMasterVariantEventDataBuilder implements Builder +{ + /** + + * @var ?string + */ + private $id; + + /** + + * @var ?int + */ + private $version; + + /** + + * @var ?string + */ + private $importContainerKey; + + /** + *

The id of the Import Operation with the waitForMasterVariant state.

+ * + + * @return null|string + */ + public function getId() + { + return $this->id; + } + + /** + *

The version of the Import Operation with the waitForMasterVariant state.

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

The key of the Import Container.

+ * + + * @return null|string + */ + public function getImportContainerKey() + { + return $this->importContainerKey; + } + + /** + * @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 ?string $importContainerKey + * @return $this + */ + public function withImportContainerKey(?string $importContainerKey) + { + $this->importContainerKey = $importContainerKey; + + return $this; + } + + + public function build(): ImportWaitForMasterVariantEventData + { + return new ImportWaitForMasterVariantEventDataModel( + $this->id, + $this->version, + $this->importContainerKey + ); + } + + public static function of(): ImportWaitForMasterVariantEventDataBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataCollection.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataCollection.php new file mode 100644 index 00000000000..bd21cd14a91 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataCollection.php @@ -0,0 +1,56 @@ + + * @method ImportWaitForMasterVariantEventData current() + * @method ImportWaitForMasterVariantEventData end() + * @method ImportWaitForMasterVariantEventData at($offset) + */ +class ImportWaitForMasterVariantEventDataCollection extends MapperSequence +{ + /** + * @psalm-assert ImportWaitForMasterVariantEventData $value + * @psalm-param ImportWaitForMasterVariantEventData|stdClass $value + * @throws InvalidArgumentException + * + * @return ImportWaitForMasterVariantEventDataCollection + */ + public function add($value) + { + if (!$value instanceof ImportWaitForMasterVariantEventData) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?ImportWaitForMasterVariantEventData + */ + protected function mapper() + { + return function (?int $index): ?ImportWaitForMasterVariantEventData { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var ImportWaitForMasterVariantEventData $data */ + $data = ImportWaitForMasterVariantEventDataModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataModel.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataModel.php new file mode 100644 index 00000000000..a1abe379e07 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventDataModel.php @@ -0,0 +1,138 @@ +id = $id; + $this->version = $version; + $this->importContainerKey = $importContainerKey; + } + + /** + *

The id of the Import Operation with the waitForMasterVariant state.

+ * + * + * @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 version of the Import Operation with the waitForMasterVariant state.

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

The key of the Import Container.

+ * + * + * @return null|string + */ + public function getImportContainerKey() + { + if (is_null($this->importContainerKey)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_IMPORT_CONTAINER_KEY); + if (is_null($data)) { + return null; + } + $this->importContainerKey = (string) $data; + } + + return $this->importContainerKey; + } + + + /** + * @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 ?string $importContainerKey + */ + public function setImportContainerKey(?string $importContainerKey): void + { + $this->importContainerKey = $importContainerKey; + } +} diff --git a/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventModel.php b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventModel.php new file mode 100644 index 00000000000..df88d314c34 --- /dev/null +++ b/lib/commercetools-api/src/Models/Event/ImportWaitForMasterVariantEventModel.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 Import Operation with the waitForMasterVariant state.

+ * + * + * @return null|ImportWaitForMasterVariantEventData + */ + public function getData() + { + if (is_null($this->data)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_DATA); + if (is_null($data)) { + return null; + } + + $this->data = ImportWaitForMasterVariantEventDataModel::of($data); + } + + return $this->data; + } + + + /** + * @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; + } + + /** + * @param ?ImportWaitForMasterVariantEventData $data + */ + public function setData(?ImportWaitForMasterVariantEventData $data): void + { + $this->data = $data; + } + + + #[\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; + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessage.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessage.php new file mode 100644 index 00000000000..ab0adfec22d --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessage.php @@ -0,0 +1,45 @@ +Top-level unit of the Business Unit after the Set Unit Type or Change Parent Unit update action.

+ * + + * @return null|BusinessUnitKeyReference + */ + public function getTopLevelUnit(); + + /** + *

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.

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

Date and time (UTC) the Message was generated.

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

Value of createdAt.

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

IDs and references that last modified the Message.

+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *

Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. + * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

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

Reference to the resource on which the change or action was performed.

+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *

Version of the resource on which the change or action was performed.

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

User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

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.

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

Date and time (UTC) the Message was generated.

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

Value of createdAt.

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

IDs and references that last modified the Message.

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

IDs and references that created the Message.

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

Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. + * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

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

Reference to the resource on which the change or action was performed.

+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE); + if (is_null($data)) { + return null; + } + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->resource = $className::of($data); + } + + return $this->resource; + } + + /** + *

Version of the resource on which the change or action was performed.

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

Message Type of the Message.

+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *

User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

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|array|null $data */ + $data = $this->raw(self::FIELD_TOP_LEVEL_UNIT); + if (is_null($data)) { + return null; + } + + $this->topLevelUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $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() + { + if (is_null($this->oldTopLevelUnit)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_OLD_TOP_LEVEL_UNIT); + if (is_null($data)) { + return null; + } + + $this->oldTopLevelUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $this->oldTopLevelUnit; + } + + + /** + * @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 $topLevelUnit + */ + public function setTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit): void + { + $this->topLevelUnit = $topLevelUnit; + } + + /** + * @param ?BusinessUnitKeyReference $oldTopLevelUnit + */ + public function setOldTopLevelUnit(?BusinessUnitKeyReference $oldTopLevelUnit): void + { + $this->oldTopLevelUnit = $oldTopLevelUnit; + } + + + #[\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/BusinessUnitTopLevelUnitSetMessagePayload.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayload.php new file mode 100644 index 00000000000..0ae14a8d24b --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTopLevelUnitSetMessagePayload.php @@ -0,0 +1,45 @@ +Top-level unit of the Business Unit after the Set Unit Type or Change Parent Unit update action.

+ * + + * @return null|BusinessUnitKeyReference + */ + public function getTopLevelUnit(); + + /** + *

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/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|array|null $data */ + $data = $this->raw(self::FIELD_TOP_LEVEL_UNIT); + if (is_null($data)) { + return null; + } + + $this->topLevelUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $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() + { + if (is_null($this->oldTopLevelUnit)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_OLD_TOP_LEVEL_UNIT); + if (is_null($data)) { + return null; + } + + $this->oldTopLevelUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $this->oldTopLevelUnit; + } + + + /** + * @param ?BusinessUnitKeyReference $topLevelUnit + */ + public function setTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit): void + { + $this->topLevelUnit = $topLevelUnit; + } + + /** + * @param ?BusinessUnitKeyReference $oldTopLevelUnit + */ + public function setOldTopLevelUnit(?BusinessUnitKeyReference $oldTopLevelUnit): void + { + $this->oldTopLevelUnit = $oldTopLevelUnit; + } +} diff --git a/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessage.php b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessage.php new file mode 100644 index 00000000000..5edd332c8f1 --- /dev/null +++ b/lib/commercetools-api/src/Models/Message/BusinessUnitTypeSetMessage.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/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.

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

Date and time (UTC) the Message was generated.

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

Value of createdAt.

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

IDs and references that last modified the Message.

+ * + + * @return null|LastModifiedBy + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy; + } + + /** + *

IDs and references that created the Message.

+ * + + * @return null|CreatedBy + */ + public function getCreatedBy() + { + return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy; + } + + /** + *

Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. + * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

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

Reference to the resource on which the change or action was performed.

+ * + + * @return null|Reference + */ + public function getResource() + { + return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource; + } + + /** + *

Version of the resource on which the change or action was performed.

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

User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

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.

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

Date and time (UTC) the Message was generated.

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

Value of createdAt.

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

IDs and references that last modified the Message.

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

IDs and references that created the Message.

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

Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. + * sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

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

Reference to the resource on which the change or action was performed.

+ * + * + * @return null|Reference + */ + public function getResource() + { + if (is_null($this->resource)) { + /** @psalm-var stdClass|array|null $data */ + $data = $this->raw(self::FIELD_RESOURCE); + if (is_null($data)) { + return null; + } + $className = ReferenceModel::resolveDiscriminatorClass($data); + $this->resource = $className::of($data); + } + + return $this->resource; + } + + /** + *

Version of the resource on which the change or action was performed.

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

Message Type of the Message.

+ * + * + * @return null|string + */ + public function getType() + { + if (is_null($this->type)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_TYPE); + if (is_null($data)) { + return null; + } + $this->type = (string) $data; + } + + return $this->type; + } + + /** + *

User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

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|array|null $data */ + $data = $this->raw(self::FIELD_PARENT_UNIT); + if (is_null($data)) { + return null; + } + + $this->parentUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $this->parentUnit; + } + + /** + *

Parent 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|array|null $data */ + $data = $this->raw(self::FIELD_OLD_PARENT_UNIT); + if (is_null($data)) { + return null; + } + + $this->oldParentUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $this->oldParentUnit; + } + + /** + *

Type 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|array|null $data */ + $data = $this->raw(self::FIELD_PARENT_UNIT); + if (is_null($data)) { + return null; + } + + $this->parentUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $this->parentUnit; + } + + /** + *

Parent 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|array|null $data */ + $data = $this->raw(self::FIELD_OLD_PARENT_UNIT); + if (is_null($data)) { + return null; + } + + $this->oldParentUnit = BusinessUnitKeyReferenceModel::of($data); + } + + return $this->oldParentUnit; + } + + /** + *

Type 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 MapperSequence + * @extends SubscriptionNotificationCollection * @psalm-method T current() * @psalm-method T end() * @psalm-method T at($offset) @@ -22,7 +22,7 @@ * @method DeliveryPayload end() * @method DeliveryPayload at($offset) */ -class DeliveryPayloadCollection extends MapperSequence +class DeliveryPayloadCollection extends SubscriptionNotificationCollection { /** * @psalm-assert T $value diff --git a/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadModel.php index 9018b5cee66..e99000a3eb8 100644 --- a/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadModel.php +++ b/lib/commercetools-api/src/Models/Subscription/DeliveryPayloadModel.php @@ -23,18 +23,17 @@ */ final class DeliveryPayloadModel extends JsonObjectModel implements DeliveryPayload { - public const DISCRIMINATOR_VALUE = ''; /** * * @var ?string */ - protected $projectKey; + protected $notificationType; /** * * @var ?string */ - protected $notificationType; + protected $projectKey; /** * @@ -48,16 +47,6 @@ final class DeliveryPayloadModel extends JsonObjectModel implements DeliveryPayl */ protected $resourceUserProvidedIdentifiers; - /** - * @psalm-var array > - * - */ - private static $discriminatorClasses = [ - 'Message' => MessageDeliveryPayloadModel::class, - 'ResourceCreated' => ResourceCreatedDeliveryPayloadModel::class, - 'ResourceDeleted' => ResourceDeletedDeliveryPayloadModel::class, - 'ResourceUpdated' => ResourceUpdatedDeliveryPayloadModel::class, - ]; /** * @psalm-suppress MissingParamType @@ -75,44 +64,44 @@ public function __construct( } /** - *

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.

* * * @return null|string */ - public function getNotificationType() + public function getProjectKey() { - if (is_null($this->notificationType)) { + if (is_null($this->projectKey)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + $data = $this->raw(self::FIELD_PROJECT_KEY); if (is_null($data)) { return null; } - $this->notificationType = (string) $data; + $this->projectKey = (string) $data; } - return $this->notificationType; + return $this->projectKey; } /** @@ -181,33 +170,4 @@ public function setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $res { $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers; } - - - - /** - * @psalm-param stdClass|array $value - * @psalm-return class-string - */ - public static function resolveDiscriminatorClass($value): string - { - $fieldName = DeliveryPayload::DISCRIMINATOR_FIELD; - if (is_object($value) && isset($value->$fieldName)) { - /** @psalm-var string $discriminatorValue */ - $discriminatorValue = $value->$fieldName; - if (isset(self::$discriminatorClasses[$discriminatorValue])) { - return self::$discriminatorClasses[$discriminatorValue]; - } - } - if (is_array($value) && isset($value[$fieldName])) { - /** @psalm-var string $discriminatorValue */ - $discriminatorValue = $value[$fieldName]; - if (isset(self::$discriminatorClasses[$discriminatorValue])) { - return self::$discriminatorClasses[$discriminatorValue]; - } - } - - /** @psalm-var class-string */ - $type = DeliveryPayloadModel::class; - return $type; - } } diff --git a/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayload.php b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayload.php new file mode 100644 index 00000000000..9c963ee6874 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventDeliveryPayload.php @@ -0,0 +1,87 @@ +Unique identifier of the Event.

+ * + + * @return null|string + */ + public function getId(); + + /** + *

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

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

+ * + + * @return null|array + */ + public function getTypes(); + + /** + * @param ?string $resourceTypeId + */ + public function setResourceTypeId(?string $resourceTypeId): void; + + /** + * @param ?array $types + */ + public function setTypes(?array $types): void; +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventSubscriptionBuilder.php b/lib/commercetools-api/src/Models/Subscription/EventSubscriptionBuilder.php new file mode 100644 index 00000000000..23d9549d331 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventSubscriptionBuilder.php @@ -0,0 +1,94 @@ + + */ +final class EventSubscriptionBuilder implements Builder +{ + /** + + * @var ?string + */ + private $resourceTypeId; + + /** + + * @var ?array + */ + private $types; + + /** + *

Unique identifier for the type of resource, for example, import-api.

+ * + + * @return null|string + */ + public function getResourceTypeId() + { + return $this->resourceTypeId; + } + + /** + *

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.

+ * + + * @return null|array + */ + public function getTypes() + { + return $this->types; + } + + /** + * @param ?string $resourceTypeId + * @return $this + */ + public function withResourceTypeId(?string $resourceTypeId) + { + $this->resourceTypeId = $resourceTypeId; + + return $this; + } + + /** + * @param ?array $types + * @return $this + */ + public function withTypes(?array $types) + { + $this->types = $types; + + return $this; + } + + + public function build(): EventSubscription + { + return new EventSubscriptionModel( + $this->resourceTypeId, + $this->types + ); + } + + public static function of(): EventSubscriptionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventSubscriptionCollection.php b/lib/commercetools-api/src/Models/Subscription/EventSubscriptionCollection.php new file mode 100644 index 00000000000..21ce304731c --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventSubscriptionCollection.php @@ -0,0 +1,56 @@ + + * @method EventSubscription current() + * @method EventSubscription end() + * @method EventSubscription at($offset) + */ +class EventSubscriptionCollection extends MapperSequence +{ + /** + * @psalm-assert EventSubscription $value + * @psalm-param EventSubscription|stdClass $value + * @throws InvalidArgumentException + * + * @return EventSubscriptionCollection + */ + public function add($value) + { + if (!$value instanceof EventSubscription) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?EventSubscription + */ + protected function mapper() + { + return function (?int $index): ?EventSubscription { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var EventSubscription $data */ + $data = EventSubscriptionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/EventSubscriptionModel.php b/lib/commercetools-api/src/Models/Subscription/EventSubscriptionModel.php new file mode 100644 index 00000000000..512cd6d3893 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/EventSubscriptionModel.php @@ -0,0 +1,104 @@ +resourceTypeId = $resourceTypeId; + $this->types = $types; + } + + /** + *

Unique identifier for the type of resource, for example, import-api.

+ * + * + * @return null|string + */ + public function getResourceTypeId() + { + if (is_null($this->resourceTypeId)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_RESOURCE_TYPE_ID); + if (is_null($data)) { + return null; + } + $this->resourceTypeId = (string) $data; + } + + return $this->resourceTypeId; + } + + /** + *

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.

+ * + * + * @return null|array + */ + public function getTypes() + { + if (is_null($this->types)) { + /** @psalm-var ?list $data */ + $data = $this->raw(self::FIELD_TYPES); + if (is_null($data)) { + return null; + } + $this->types = $data; + } + + return $this->types; + } + + + /** + * @param ?string $resourceTypeId + */ + public function setResourceTypeId(?string $resourceTypeId): void + { + $this->resourceTypeId = $resourceTypeId; + } + + /** + * @param ?array $types + */ + public function setTypes(?array $types): void + { + $this->types = $types; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/MessageDeliveryPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/MessageDeliveryPayloadModel.php index 0ce5967c415..4538dccf5f6 100644 --- a/lib/commercetools-api/src/Models/Subscription/MessageDeliveryPayloadModel.php +++ b/lib/commercetools-api/src/Models/Subscription/MessageDeliveryPayloadModel.php @@ -29,13 +29,13 @@ final class MessageDeliveryPayloadModel extends JsonObjectModel implements Messa * * @var ?string */ - protected $projectKey; + protected $notificationType; /** * * @var ?string */ - protected $notificationType; + protected $projectKey; /** * @@ -122,44 +122,44 @@ public function __construct( } /** - *

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.

* * * @return null|string */ - public function getNotificationType() + public function getProjectKey() { - if (is_null($this->notificationType)) { + if (is_null($this->projectKey)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + $data = $this->raw(self::FIELD_PROJECT_KEY); if (is_null($data)) { return null; } - $this->notificationType = (string) $data; + $this->projectKey = (string) $data; } - return $this->notificationType; + return $this->projectKey; } /** diff --git a/lib/commercetools-api/src/Models/Subscription/ResourceCreatedDeliveryPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/ResourceCreatedDeliveryPayloadModel.php index c6608bac0b4..bf39e478862 100644 --- a/lib/commercetools-api/src/Models/Subscription/ResourceCreatedDeliveryPayloadModel.php +++ b/lib/commercetools-api/src/Models/Subscription/ResourceCreatedDeliveryPayloadModel.php @@ -29,13 +29,13 @@ final class ResourceCreatedDeliveryPayloadModel extends JsonObjectModel implemen * * @var ?string */ - protected $projectKey; + protected $notificationType; /** * * @var ?string */ - protected $notificationType; + protected $projectKey; /** * @@ -82,44 +82,44 @@ public function __construct( } /** - *

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.

* * * @return null|string */ - public function getNotificationType() + public function getProjectKey() { - if (is_null($this->notificationType)) { + if (is_null($this->projectKey)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + $data = $this->raw(self::FIELD_PROJECT_KEY); if (is_null($data)) { return null; } - $this->notificationType = (string) $data; + $this->projectKey = (string) $data; } - return $this->notificationType; + return $this->projectKey; } /** diff --git a/lib/commercetools-api/src/Models/Subscription/ResourceDeletedDeliveryPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/ResourceDeletedDeliveryPayloadModel.php index 8cfc4f5ed86..0a801f5e77b 100644 --- a/lib/commercetools-api/src/Models/Subscription/ResourceDeletedDeliveryPayloadModel.php +++ b/lib/commercetools-api/src/Models/Subscription/ResourceDeletedDeliveryPayloadModel.php @@ -29,13 +29,13 @@ final class ResourceDeletedDeliveryPayloadModel extends JsonObjectModel implemen * * @var ?string */ - protected $projectKey; + protected $notificationType; /** * * @var ?string */ - protected $notificationType; + protected $projectKey; /** * @@ -90,44 +90,44 @@ public function __construct( } /** - *

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.

* * * @return null|string */ - public function getNotificationType() + public function getProjectKey() { - if (is_null($this->notificationType)) { + if (is_null($this->projectKey)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + $data = $this->raw(self::FIELD_PROJECT_KEY); if (is_null($data)) { return null; } - $this->notificationType = (string) $data; + $this->projectKey = (string) $data; } - return $this->notificationType; + return $this->projectKey; } /** diff --git a/lib/commercetools-api/src/Models/Subscription/ResourceUpdatedDeliveryPayloadModel.php b/lib/commercetools-api/src/Models/Subscription/ResourceUpdatedDeliveryPayloadModel.php index 5aa1ac68384..0ee0b24a157 100644 --- a/lib/commercetools-api/src/Models/Subscription/ResourceUpdatedDeliveryPayloadModel.php +++ b/lib/commercetools-api/src/Models/Subscription/ResourceUpdatedDeliveryPayloadModel.php @@ -29,13 +29,13 @@ final class ResourceUpdatedDeliveryPayloadModel extends JsonObjectModel implemen * * @var ?string */ - protected $projectKey; + protected $notificationType; /** * * @var ?string */ - protected $notificationType; + protected $projectKey; /** * @@ -90,44 +90,44 @@ public function __construct( } /** - *

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.

* * * @return null|string */ - public function getNotificationType() + public function getProjectKey() { - if (is_null($this->notificationType)) { + if (is_null($this->projectKey)) { /** @psalm-var ?string $data */ - $data = $this->raw(self::FIELD_NOTIFICATION_TYPE); + $data = $this->raw(self::FIELD_PROJECT_KEY); if (is_null($data)) { return null; } - $this->notificationType = (string) $data; + $this->projectKey = (string) $data; } - return $this->notificationType; + return $this->projectKey; } /** diff --git a/lib/commercetools-api/src/Models/Subscription/Subscription.php b/lib/commercetools-api/src/Models/Subscription/Subscription.php index 42fdcfb088a..915a729ea3a 100644 --- a/lib/commercetools-api/src/Models/Subscription/Subscription.php +++ b/lib/commercetools-api/src/Models/Subscription/Subscription.php @@ -23,6 +23,7 @@ interface Subscription extends BaseResource 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'; public const FIELD_STATUS = 'status'; @@ -106,6 +107,14 @@ public function getKey(); */ public function getMessages(); + /** + *

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 ?list $data */ + $data = $this->raw(self::FIELD_EVENTS); + if (is_null($data)) { + return null; + } + $this->events = EventSubscriptionCollection::fromArray($data); + } + + return $this->events; + } + /** *

Format 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 ?list $data */ + $data = $this->raw(self::FIELD_EVENTS); + if (is_null($data)) { + return null; + } + $this->events = EventSubscriptionCollection::fromArray($data); + } + + return $this->events; + } + /** *

Format 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|array $value + * @psalm-return class-string + */ + public static function resolveDiscriminatorClass($value): string + { + $fieldName = SubscriptionNotification::DISCRIMINATOR_FIELD; + if (is_object($value) && isset($value->$fieldName)) { + /** @psalm-var string $discriminatorValue */ + $discriminatorValue = $value->$fieldName; + if (isset(self::$discriminatorClasses[$discriminatorValue])) { + return self::$discriminatorClasses[$discriminatorValue]; + } + } + if (is_array($value) && isset($value[$fieldName])) { + /** @psalm-var string $discriminatorValue */ + $discriminatorValue = $value[$fieldName]; + if (isset(self::$discriminatorClasses[$discriminatorValue])) { + return self::$discriminatorClasses[$discriminatorValue]; + } + } + + /** @psalm-var class-string */ + $type = SubscriptionNotificationModel::class; + return $type; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesAction.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesAction.php index 633564279da..c74a377e988 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesAction.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesAction.php @@ -16,7 +16,7 @@ interface SubscriptionSetChangesAction extends SubscriptionUpdateAction public const FIELD_CHANGES = 'changes'; /** - *

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.

* * @return null|ChangeSubscriptionCollection diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionBuilder.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionBuilder.php index 199d9c4c4e4..fc851c9cc2a 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionBuilder.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionBuilder.php @@ -27,7 +27,7 @@ final class SubscriptionSetChangesActionBuilder implements Builder private $changes; /** - *

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.

* * @return null|ChangeSubscriptionCollection diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionModel.php index e8f14cbe685..f133c5db4ac 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionModel.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetChangesActionModel.php @@ -63,7 +63,7 @@ public function getAction() } /** - *

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.

* * * @return null|ChangeSubscriptionCollection diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsAction.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsAction.php new file mode 100644 index 00000000000..e58881587ec --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsAction.php @@ -0,0 +1,30 @@ +Value to set. Can only be unset if either 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.

+ * + + * @return null|EventSubscriptionCollection + */ + public function getMessages() + { + return $this->messages; + } + + /** + * @param ?EventSubscriptionCollection $messages + * @return $this + */ + public function withMessages(?EventSubscriptionCollection $messages) + { + $this->messages = $messages; + + return $this; + } + + + public function build(): SubscriptionSetEventsAction + { + return new SubscriptionSetEventsActionModel( + $this->messages + ); + } + + public static function of(): SubscriptionSetEventsActionBuilder + { + return new self(); + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionCollection.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionCollection.php new file mode 100644 index 00000000000..a22049602e6 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionCollection.php @@ -0,0 +1,56 @@ + + * @method SubscriptionSetEventsAction current() + * @method SubscriptionSetEventsAction end() + * @method SubscriptionSetEventsAction at($offset) + */ +class SubscriptionSetEventsActionCollection extends SubscriptionUpdateActionCollection +{ + /** + * @psalm-assert SubscriptionSetEventsAction $value + * @psalm-param SubscriptionSetEventsAction|stdClass $value + * @throws InvalidArgumentException + * + * @return SubscriptionSetEventsActionCollection + */ + public function add($value) + { + if (!$value instanceof SubscriptionSetEventsAction) { + throw new InvalidArgumentException(); + } + $this->store($value); + + return $this; + } + + /** + * @psalm-return callable(int):?SubscriptionSetEventsAction + */ + protected function mapper() + { + return function (?int $index): ?SubscriptionSetEventsAction { + $data = $this->get($index); + if ($data instanceof stdClass) { + /** @var SubscriptionSetEventsAction $data */ + $data = SubscriptionSetEventsActionModel::of($data); + $this->set($data, $index); + } + + return $data; + }; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionModel.php new file mode 100644 index 00000000000..0719125b1e2 --- /dev/null +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetEventsActionModel.php @@ -0,0 +1,93 @@ +messages = $messages; + $this->action = $action ?? self::DISCRIMINATOR_VALUE; + } + + /** + * + * @return null|string + */ + public function getAction() + { + if (is_null($this->action)) { + /** @psalm-var ?string $data */ + $data = $this->raw(self::FIELD_ACTION); + if (is_null($data)) { + return null; + } + $this->action = (string) $data; + } + + return $this->action; + } + + /** + *

Value to set. Can only be unset if either messages or changes is set.

+ * + * + * @return null|EventSubscriptionCollection + */ + public function getMessages() + { + if (is_null($this->messages)) { + /** @psalm-var ?list $data */ + $data = $this->raw(self::FIELD_MESSAGES); + if (is_null($data)) { + return null; + } + $this->messages = EventSubscriptionCollection::fromArray($data); + } + + return $this->messages; + } + + + /** + * @param ?EventSubscriptionCollection $messages + */ + public function setMessages(?EventSubscriptionCollection $messages): void + { + $this->messages = $messages; + } +} diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesAction.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesAction.php index d487ad8d69b..87853ee1239 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesAction.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesAction.php @@ -16,7 +16,7 @@ interface SubscriptionSetMessagesAction extends SubscriptionUpdateAction public const FIELD_MESSAGES = 'messages'; /** - *

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.

* * @return null|MessageSubscriptionCollection diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionBuilder.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionBuilder.php index 7f2c82b3888..cf64c953369 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionBuilder.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionBuilder.php @@ -27,7 +27,7 @@ final class SubscriptionSetMessagesActionBuilder implements Builder private $messages; /** - *

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.

* * @return null|MessageSubscriptionCollection diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionModel.php index 1e24a941496..d6f9590a8ba 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionModel.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionSetMessagesActionModel.php @@ -63,7 +63,7 @@ public function getAction() } /** - *

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.

* * * @return null|MessageSubscriptionCollection diff --git a/lib/commercetools-api/src/Models/Subscription/SubscriptionUpdateActionModel.php b/lib/commercetools-api/src/Models/Subscription/SubscriptionUpdateActionModel.php index d4b8ab4caef..63a0e2d2a10 100644 --- a/lib/commercetools-api/src/Models/Subscription/SubscriptionUpdateActionModel.php +++ b/lib/commercetools-api/src/Models/Subscription/SubscriptionUpdateActionModel.php @@ -33,6 +33,7 @@ final class SubscriptionUpdateActionModel extends JsonObjectModel implements Sub private static $discriminatorClasses = [ 'changeDestination' => SubscriptionChangeDestinationActionModel::class, 'setChanges' => SubscriptionSetChangesActionModel::class, + 'setEvents' => SubscriptionSetEventsActionModel::class, 'setKey' => SubscriptionSetKeyActionModel::class, 'setMessages' => SubscriptionSetMessagesActionModel::class, ]; diff --git a/lib/commercetools-import/docs/RequestBuilder.md b/lib/commercetools-import/docs/RequestBuilder.md index ca6bb01272d..9815569a094 100644 --- a/lib/commercetools-import/docs/RequestBuilder.md +++ b/lib/commercetools-import/docs/RequestBuilder.md @@ -58,7 +58,10 @@ $request = $builder ``` ## `withProjectKeyValue("projectKey")->importContainers()->post(null)` -Creates a new import container. +Creates a new Import Container. + +Generates the [ImportContainerCreated](/projects/events#import-container-created-event) Event. + ### Example ```php @@ -72,7 +75,7 @@ $request = $builder ``` ## `withProjectKeyValue("projectKey")->importContainers()->get()` -Retrieves all import containers of a given project key. +Retrieves all Import Containers of a given project key. ### Example ```php @@ -86,7 +89,7 @@ $request = $builder ``` ## `withProjectKeyValue("projectKey")->importContainers()->withImportContainerKeyValue("importContainerKey")->put(null)` -Updates the import container given by the key. +Updates the Import Container given by the key. ### Example ```php @@ -101,7 +104,7 @@ $request = $builder ``` ## `withProjectKeyValue("projectKey")->importContainers()->withImportContainerKeyValue("importContainerKey")->get()` -Retrieves the import container given by the key. +Retrieves the Import Container given by the key. ### Example ```php @@ -116,7 +119,10 @@ $request = $builder ``` ## `withProjectKeyValue("projectKey")->importContainers()->withImportContainerKeyValue("importContainerKey")->delete()` -Deletes the import container given by the key. +Deletes the Import Container specified by the `importContainerKey`. + +Generates the [ImportContainerDeleted](/projects/events#import-container-deleted-event) Event. + ### Example ```php @@ -148,7 +154,7 @@ $request = $builder ``` ## `withProjectKeyValue("projectKey")->importContainers()->withImportContainerKeyValue("importContainerKey")->importSummaries()->get()` -Retrieves an [ImportSummary](ctp:import:type:ImportSummary) for the given import container. An [ImportSummary](ctp:import:type:ImportSummary) is calculated on demand. +Retrieves an [ImportSummary](ctp:import:type:ImportSummary) for the given Import Container. An [ImportSummary](ctp:import:type:ImportSummary) is calculated on demand. ### Example diff --git a/references.txt b/references.txt index 3f3a2ceb7d8..b6fb2dca5a3 100644 --- a/references.txt +++ b/references.txt @@ -388,3 +388,4 @@ a33feaab360e352573f683dd36889c80735e3900 6082ac4e80a66d271c68785c32ea07853e8211ef 00b9b10ab0fb8d96f289094775fe082b48068a5e 4055fc15c037521387c7c7687cfceee73527f55f +ab43d3845fcab04a4e74bada3ddedf2d8b28472f