Skip to content

Commit

Permalink
Add api_id to get and list MDR responses
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsin-plivo committed Apr 26, 2023
1 parent c00722c commit dff5e08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [v4.46.0](https://github.com/plivo/plivo-php/tree/v4.46.0) (2023-04-25)
- Add `replacedSender` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message)
- Add `apiId` to the responses for the list all messages API and the get message details API

## [v4.45.0](https://github.com/plivo/plivo-php/tree/v4.45.1) (2023-04-11)
**Feature - Added New Param 'source_ip' in GetCall and ListCalls**
Expand Down
3 changes: 3 additions & 0 deletions src/Plivo/Resources/Message/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public function __construct(
];

// handled empty string and null case
if (!empty($response['api_id'])) {
$this->properties['apiId'] = $response['api_id'];
}
if (!empty($response['powerpack_id'])) {
$this->properties['powerpackID'] = $response['powerpack_id'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Resources/Message/MessageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function getList($optionalArgs = [])
$newMessage = new Message($this->client, $message, $this->pathParams['authId'], $this->uri);
array_push($messages, $newMessage);
}
return new MessageList($this->client, $response->getContent()['meta'], $messages);
return new MessageList($this->client, $response->getContent()['meta'], $messages, $response->getContent()["api_id"]);
} else {
throw new PlivoResponseException(
$response->getContent()['error'],
Expand Down
9 changes: 8 additions & 1 deletion src/Plivo/Resources/Message/MessageList.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@
class MessageList extends ResourceList
{

/**
* @var
*/
public $apiId;

/**
* MessageList constructor.
* @param MessageClient $plivoClient
* @param $meta
* @param array $resources
* @param string $apiId
*/
function __construct(MessageClient $plivoClient, $meta, array $resources)
function __construct(MessageClient $plivoClient, $meta, array $resources, $apiId=null)
{
parent::__construct($plivoClient, $meta, $resources);
$this->apiId = $apiId;
}
}

0 comments on commit dff5e08

Please sign in to comment.