diff --git a/src/PubNub/Endpoints/MessageActions/GetMessageAction.php b/src/PubNub/Endpoints/MessageActions/GetMessageActions.php similarity index 95% rename from src/PubNub/Endpoints/MessageActions/GetMessageAction.php rename to src/PubNub/Endpoints/MessageActions/GetMessageActions.php index 185ab46..73a1f6a 100644 --- a/src/PubNub/Endpoints/MessageActions/GetMessageAction.php +++ b/src/PubNub/Endpoints/MessageActions/GetMessageActions.php @@ -11,7 +11,7 @@ use PubNub\Models\Consumer\MessageActions\PNGetMessageActionResult; /** @package PubNub\Endpoints\MessageActions */ -class GetMessageAction extends Endpoint +class GetMessageActions extends Endpoint { protected bool $endpointAuthRequired = true; protected int $endpointConnectTimeout; @@ -37,7 +37,7 @@ public function __construct(PubNub $pubnub) * Set a channel for the message action * * @param string $channel - * @return GetMessageAction + * @return GetMessageActions */ public function channel(string $channel): self { @@ -49,7 +49,7 @@ public function channel(string $channel): self * Reaction timetoken denoting the start of the range requested. Returned values will be less than start. * * @param string $start - * @return GetMessageAction + * @return GetMessageActions */ public function setStart(string $start): self { @@ -61,7 +61,7 @@ public function setStart(string $start): self * Reaction timetoken denoting the end of the range requested. Returned values will be greater than or equal to end. * * @param string $end - * @return GetMessageAction + * @return GetMessageActions */ public function setEnd(string $end): self { @@ -73,7 +73,7 @@ public function setEnd(string $end): self * Number of reactions to return in response. * * @param int $limit - * @return GetMessageAction + * @return GetMessageActions */ public function setLimit(int $limit): self { diff --git a/src/PubNub/Endpoints/MessageActions/RemoveMessageAction.php b/src/PubNub/Endpoints/MessageActions/RemoveMessageAction.php index 43d2732..d16e877 100644 --- a/src/PubNub/Endpoints/MessageActions/RemoveMessageAction.php +++ b/src/PubNub/Endpoints/MessageActions/RemoveMessageAction.php @@ -22,8 +22,8 @@ class RemoveMessageAction extends Endpoint protected const DELETE_PATH = "/v1/message-actions/%s/channel/%s/message/%s/action/%s"; protected string $channel; - protected int | float $messageTimetoken; - protected int | float $actionTimetoken; + protected int $messageTimetoken; + protected int $actionTimetoken; public function __construct(PubNub $pubnub) { @@ -47,10 +47,10 @@ public function channel(string $channel): self /** * The publish timetoken of a parent message. * - * @param int | float $messageTimetoken + * @param int $messageTimetoken * @return RemoveMessageAction */ - public function messageTimetoken(int | float $messageTimetoken): self + public function messageTimetoken(int $messageTimetoken): self { $this->messageTimetoken = $messageTimetoken; return $this; @@ -59,10 +59,10 @@ public function messageTimetoken(int | float $messageTimetoken): self /** * The publish timetoken of the reaction. * - * @param int | float $actionTimetoken + * @param int $actionTimetoken * @return RemoveMessageAction */ - public function actionTimetoken(int | float $actionTimetoken): self + public function actionTimetoken(int $actionTimetoken): self { $this->actionTimetoken = $actionTimetoken; return $this; diff --git a/src/PubNub/Models/Consumer/MessageActions/PNMessageAction.php b/src/PubNub/Models/Consumer/MessageActions/PNMessageAction.php index fe6a07f..e324e6a 100644 --- a/src/PubNub/Models/Consumer/MessageActions/PNMessageAction.php +++ b/src/PubNub/Models/Consumer/MessageActions/PNMessageAction.php @@ -6,9 +6,9 @@ class PNMessageAction { public ?string $type; public ?string $value; - public int | float | null $messageTimetoken; + public ?int $messageTimetoken; public ?string $uuid; - public int | float | null $actionTimetoken; + public ?int $actionTimetoken; /** * diff --git a/src/PubNub/PubNub.php b/src/PubNub/PubNub.php index 66c1b1f..ed3f037 100644 --- a/src/PubNub/PubNub.php +++ b/src/PubNub/PubNub.php @@ -18,7 +18,7 @@ use PubNub\Endpoints\HistoryDelete; use PubNub\Endpoints\MessageCount; use PubNub\Endpoints\MessageActions\AddMessageAction; -use PubNub\Endpoints\MessageActions\GetMessageAction; +use PubNub\Endpoints\MessageActions\GetMessageActions; use PubNub\Endpoints\MessageActions\RemoveMessageAction; use PubNub\Endpoints\MessagePersistance\FetchMessages; use PubNub\Endpoints\Objects\Channel\SetChannelMetadata; @@ -616,9 +616,9 @@ public function addMessageAction(): AddMessageAction return new AddMessageAction($this); } - public function getMessageAction(): GetMessageAction + public function getMessageActions(): GetMessageActions { - return new GetMessageAction($this); + return new GetMessageActions($this); } public function removeMessageAction(): RemoveMessageAction diff --git a/tests/integrational/MessageActionsTest.php b/tests/integrational/MessageActionsTest.php index 290b565..bf7231a 100644 --- a/tests/integrational/MessageActionsTest.php +++ b/tests/integrational/MessageActionsTest.php @@ -59,16 +59,16 @@ public function testAddMessageAction(): void public function testGetMessageAction(): void { $addMessageActionResult = $this->addTestMessageAction(); - $getMessageActionResult = $this->pubnub->getMessageAction() + $getMessageActionsResult = $this->pubnub->getMessageActions() ->channel($this->channelName) ->sync(); - $this->assertNotNull($getMessageActionResult); - $this->assertInstanceOf(PNGetMessageActionResult::class, $getMessageActionResult); - $this->assertNotEmpty($getMessageActionResult->actions); - $this->assertCount(1, $getMessageActionResult->actions); + $this->assertNotNull($getMessageActionsResult); + $this->assertInstanceOf(PNGetMessageActionResult::class, $getMessageActionsResult); + $this->assertNotEmpty($getMessageActionsResult->actions); + $this->assertCount(1, $getMessageActionsResult->actions); - $messageAction = $getMessageActionResult->actions[0]; + $messageAction = $getMessageActionsResult->actions[0]; $this->assertInstanceOf(PNMessageAction::class, $messageAction); $this->assertEquals("reaction", $messageAction->type); $this->assertEquals("angry_face", $messageAction->value); @@ -80,16 +80,16 @@ public function testDeleteMessageAction(): void { $addMessageActionResult = $this->addTestMessageAction(); - $getMessageActionResult = $this->pubnub->getMessageAction() + $getMessageActionsResult = $this->pubnub->getMessageActions() ->channel($this->channelName) ->sync(); - $this->assertNotNull($getMessageActionResult); - $this->assertInstanceOf(PNGetMessageActionResult::class, $getMessageActionResult); - $this->assertNotEmpty($getMessageActionResult->actions); - $this->assertCount(1, $getMessageActionResult->actions); + $this->assertNotNull($getMessageActionsResult); + $this->assertInstanceOf(PNGetMessageActionResult::class, $getMessageActionsResult); + $this->assertNotEmpty($getMessageActionsResult->actions); + $this->assertCount(1, $getMessageActionsResult->actions); - foreach ($getMessageActionResult->actions as $action) { + foreach ($getMessageActionsResult->actions as $action) { $removeMessageActionResult = $this->pubnub->removeMessageAction() ->channel($this->channelName) ->messageTimetoken($action->messageTimetoken)