-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pluralize getMessageActions typo (#113)
* Pluralize getMessageActions typo * Fix typo for singular getMessageActions * Post review * bump workflow * PubNub SDK 7.2.1 release. --------- Co-authored-by: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com>
- Loading branch information
1 parent
d39a925
commit bd89ea0
Showing
13 changed files
with
211 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
## 7.2.1 | ||
February 03 2025 | ||
|
||
#### Fixed | ||
- Pluralize getMessageActions and fix typing. | ||
|
||
## 7.2.0 | ||
January 02 2025 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
src/PubNub/Endpoints/MessageActions/GetMessageActions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<?php | ||
|
||
namespace PubNub\Endpoints\MessageActions; | ||
|
||
use PubNub\PubNub; | ||
use PubNub\Endpoints\Endpoint; | ||
use PubNub\Enums\PNHttpMethod; | ||
use PubNub\Enums\PNOperationType; | ||
use PubNub\Exceptions\PubNubValidationException; | ||
use PubNub\Exceptions\PubNubBuildRequestException; | ||
use PubNub\Models\Consumer\MessageActions\PNGetMessageActionsResult; | ||
|
||
/** @package PubNub\Endpoints\MessageActions */ | ||
class GetMessageActions extends Endpoint | ||
{ | ||
protected bool $endpointAuthRequired = true; | ||
protected int $endpointConnectTimeout; | ||
protected int $endpointRequestTimeout; | ||
protected string $endpointHttpMethod = PNHttpMethod::GET; | ||
protected int $endpointOperationType = PNOperationType::PNGetMessageActionsOperation; | ||
protected string $endpointName = "Get Message Actions"; | ||
|
||
protected const GET_PATH = "/v1/message-actions/%s/channel/%s"; | ||
protected string $channel; | ||
protected ?string $start; | ||
protected ?string $end; | ||
protected ?int $limit; | ||
|
||
public function __construct(PubNub $pubnub) | ||
{ | ||
parent::__construct($pubnub); | ||
$this->endpointConnectTimeout = $this->pubnub->getConfiguration()->getConnectTimeout(); | ||
$this->endpointRequestTimeout = $this->pubnub->getConfiguration()->getNonSubscribeRequestTimeout(); | ||
} | ||
|
||
/** | ||
* Set a channel for the message action | ||
* | ||
* @param string $channel | ||
* @return GetMessageActions | ||
*/ | ||
public function channel(string $channel): self | ||
{ | ||
$this->channel = $channel; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Reaction timetoken denoting the start of the range requested. Returned values will be less than start. | ||
* | ||
* @param string $start | ||
* @return GetMessageActions | ||
*/ | ||
public function setStart(string $start): self | ||
{ | ||
$this->start = $start; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Reaction timetoken denoting the end of the range requested. Returned values will be greater than or equal to end. | ||
* | ||
* @param string $end | ||
* @return GetMessageActions | ||
*/ | ||
public function setEnd(string $end): self | ||
{ | ||
$this->end = $end; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Number of reactions to return in response. | ||
* | ||
* @param int $limit | ||
* @return GetMessageActions | ||
*/ | ||
public function setLimit(int $limit): self | ||
{ | ||
$this->limit = $limit; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @throws PubNubValidationException | ||
*/ | ||
protected function validateParams(): void | ||
{ | ||
if (!$this->channel) { | ||
throw new PubNubValidationException("Channel Missing"); | ||
} | ||
$this->validateSubscribeKey(); | ||
$this->validatePublishKey(); | ||
} | ||
|
||
/** | ||
* @return array<string, string> | ||
*/ | ||
protected function customParams() | ||
{ | ||
$params = []; | ||
|
||
if (isset($this->start)) { | ||
$params['start'] = $this->start; | ||
} | ||
if (isset($this->end)) { | ||
$params['end'] = $this->end; | ||
} | ||
if (isset($this->limit)) { | ||
$params['limit'] = $this->limit; | ||
} | ||
|
||
return $params; | ||
} | ||
|
||
/** | ||
* @return string | null | ||
*/ | ||
protected function buildData() | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @return string | ||
* @throws PubNubBuildRequestException | ||
*/ | ||
protected function buildPath() | ||
{ | ||
return sprintf( | ||
self::GET_PATH, | ||
$this->pubnub->getConfiguration()->getSubscribeKey(), | ||
$this->channel | ||
); | ||
} | ||
|
||
/** | ||
* @return PNGetMessageActionsResult | ||
*/ | ||
public function sync(): PNGetMessageActionsResult | ||
{ | ||
return parent::sync(); | ||
} | ||
|
||
/** | ||
* @param array<string, string> $json Decoded json | ||
* @return PNGetMessageActionsResult | ||
*/ | ||
protected function createResponse($json): PNGetMessageActionsResult | ||
{ | ||
return PNGetMessageActionsResult::fromJson($json); | ||
} | ||
} |
Oops, something went wrong.