Skip to content

Commit

Permalink
Pluralize getMessageActions typo
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Jan 8, 2025
1 parent 87962c5 commit bd7669e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions src/PubNub/Endpoints/MessageActions/RemoveMessageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/PubNub/Models/Consumer/MessageActions/PNMessageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
*
Expand Down
6 changes: 3 additions & 3 deletions src/PubNub/PubNub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions tests/integrational/MessageActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit bd7669e

Please sign in to comment.