diff --git a/src/Core/Model/Subscription/MessageDelivery.php b/src/Core/Model/Subscription/MessageDelivery.php index 9294dc331c..5944d36e12 100644 --- a/src/Core/Model/Subscription/MessageDelivery.php +++ b/src/Core/Model/Subscription/MessageDelivery.php @@ -30,6 +30,8 @@ * @method MessageDelivery setCreatedAt(DateTime $createdAt = null) * @method DateTimeDecorator getLastModifiedAt() * @method MessageDelivery setLastModifiedAt(DateTime $lastModifiedAt = null) + * @method PayloadNotIncluded getPayloadNotIncluded() + * @method MessageDelivery setPayloadNotIncluded(PayloadNotIncluded $payloadNotIncluded = null) */ class MessageDelivery extends Delivery { @@ -51,13 +53,28 @@ public function fieldDefinitions() static::TYPE => DateTime::class, static::DECORATOR => DateTimeDecorator::class ], + 'payloadNotIncluded' => [static::TYPE => PayloadNotIncluded::class], ] ); return $definition; } + /** + * @return Message + */ public function getMessage() { return Message::fromArray($this->rawData); } + + /** + * @return string + */ + public function getMessageType() + { + if (is_null($this->getPayloadNotIncluded())) { + return $this->getMessage()->getType(); + } + return $this->getPayloadNotIncluded()->getPayloadType(); + } } diff --git a/src/Core/Model/Subscription/MessageSubscription.php b/src/Core/Model/Subscription/MessageSubscription.php index 9c81870dca..4d10ca2b07 100644 --- a/src/Core/Model/Subscription/MessageSubscription.php +++ b/src/Core/Model/Subscription/MessageSubscription.php @@ -21,7 +21,7 @@ public function fieldDefinitions() { return [ 'resourceTypeId' => [static::TYPE => 'string'], - 'types' => [static::TYPE => 'array'] + 'types' => [static::TYPE => 'array'], ]; } } diff --git a/src/Core/Model/Subscription/PayloadNotIncluded.php b/src/Core/Model/Subscription/PayloadNotIncluded.php new file mode 100644 index 0000000000..5222e2dc59 --- /dev/null +++ b/src/Core/Model/Subscription/PayloadNotIncluded.php @@ -0,0 +1,26 @@ + [static::TYPE => 'string'], + 'payloadType' => [static::TYPE => 'string'], + ]; + } +}