Skip to content

Commit

Permalink
Pluralize getMessageActions typo (#113)
Browse files Browse the repository at this point in the history
* 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
seba-aln and pubnub-release-bot authored Feb 3, 2025
1 parent d39a925 commit bd89ea0
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
if: failure()
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
- name: Expose acceptance tests reports
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: acceptance-test-reports
path: ./tests/Acceptance/reports
Expand Down
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: php
version: 7.2.0
version: 7.2.1
schema: 1
scm: github.com/pubnub/php
changelog:
- date: 2025-02-03
version: 7.2.1
changes:
- type: bug
text: "Pluralize getMessageActions and fix typing."
- date: 2025-01-02
version: 7.2.0
changes:
Expand Down Expand Up @@ -437,8 +442,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: php-7.2.0.zip
location: https://github.com/pubnub/php/releases/tag/7.2.0
package-name: php-7.2.1.zip
location: https://github.com/pubnub/php/releases/tag/7.2.1
requires:
- name: rmccue/requests
min-version: 1.0.0
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
{
"require": {
<!-- include the latest version from the badge at the top -->
"pubnub/pubnub": "7.2.0"
"pubnub/pubnub": "7.2.1"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["api", "real-time", "realtime", "real time", "ajax", "push"],
"homepage": "http://www.pubnub.com/",
"license": "proprietary",
"version": "7.2.0",
"version": "7.2.1",
"authors": [
{
"name": "PubNub",
Expand Down
144 changes: 4 additions & 140 deletions src/PubNub/Endpoints/MessageActions/GetMessageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,151 +3,15 @@
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\PNGetMessageActionResult;
use PubNub\Endpoints\MessageActions\GetMessageActions;

// TODO: Remove in 8.0.0
/** @package PubNub\Endpoints\MessageActions */
class GetMessageAction extends Endpoint
class GetMessageAction extends GetMessageActions
{
protected bool $endpointAuthRequired = true;
protected int $endpointConnectTimeout;
protected int $endpointRequestTimeout;
protected string $endpointHttpMethod = PNHttpMethod::GET;
protected int $endpointOperationType = PNOperationType::PNGetMessageActionOperation;
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)
{
trigger_error("This class is deprecated. Please use GetMessageActions instead.", E_USER_DEPRECATED);
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 GetMessageAction
*/
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 GetMessageAction
*/
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 GetMessageAction
*/
public function setEnd(string $end): self
{
$this->end = $end;
return $this;
}

/**
* Number of reactions to return in response.
*
* @param int $limit
* @return GetMessageAction
*/
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 PNGetMessageActionResult
*/
public function sync(): PNGetMessageActionResult
{
return parent::sync();
}

/**
* @param array<string, string> $json Decoded json
* @return PNGetMessageActionResult
*/
protected function createResponse($json): PNGetMessageActionResult
{
return PNGetMessageActionResult::fromJson($json);
}
}
153 changes: 153 additions & 0 deletions src/PubNub/Endpoints/MessageActions/GetMessageActions.php
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);
}
}
Loading

0 comments on commit bd89ea0

Please sign in to comment.