Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new params and updated UTs #302

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
00915ea
Added new params and updated UTs
anindya-plivo Feb 27, 2023
7ee3162
added exception handling for retrive all calls
saksham-plivo Feb 27, 2023
42afe05
changed error condition
saksham-plivo Feb 28, 2023
eec918d
version update
saksham-plivo Feb 28, 2023
90d9c85
version update
saksham-plivo Feb 28, 2023
a840dba
patch version update
saksham-plivo Feb 28, 2023
8d659f7
Merge pull request #303 from plivo/VT-5344
abhishekGupta-Plivo Mar 1, 2023
22388b1
SMS-4946/SMS-4848: Add Is Domestic to Get and List Messages
saurabhnewatiya-plivo Feb 22, 2023
cadeb05
typo fix
saurabhnewatiya-plivo Mar 3, 2023
8f4d4b7
Merge pull request #300 from plivo/SMS-4946
narayana-plivo Mar 7, 2023
a3fdd33
Added new params and updated UTs
anindya-plivo Feb 27, 2023
e1c77a3
updated changelog and version
anindya-plivo Mar 8, 2023
c997893
Merge remote-tracking branch 'origin/VT-5270' into VT-5270
anindya-plivo Mar 8, 2023
58b0b73
local docker enhancement
mohsin-plivo Mar 9, 2023
6d0b4c7
Fix make test command
mohsin-plivo Mar 16, 2023
5881558
Merge pull request #304 from plivo/local-docker-enhancement
renoldthomas-plivo Mar 17, 2023
75e5496
deprecated null to string assignment fix
narayana-plivo Mar 23, 2023
1d50ac8
typo fix
narayana-plivo Mar 24, 2023
5fa372a
fix mandatory param typo
narayana-plivo Mar 24, 2023
e876020
fix UT build
narayana-plivo Mar 24, 2023
9de873b
UT fix
narayana-plivo Mar 24, 2023
833c65d
Merge pull request #309 from plivo/fix-deprecated-null
narayana-plivo Mar 24, 2023
3c1f68d
version update for created_at field in list, get brand, campaign, pro…
Mar 17, 2023
48282ed
Adding created_at field in mocks
Mar 20, 2023
0055aa9
Merge pull request #310 from plivo/SMS-5098
narayana-plivo Mar 24, 2023
180545a
Added new params and updated UTs
anindya-plivo Feb 27, 2023
cd12942
updated changelog and version
anindya-plivo Mar 8, 2023
a053fd8
Merge remote-tracking branch 'origin/VT-5270' into VT-5270
anindya-plivo Apr 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Change Log
## [4.43.1](https://github.com/plivo/plivo-java/tree/v4.43.1) (2023-03-08)
- Added `cost`, `rounded_duration`, and `days_of_storage` parameters to the response for [get single recording API](https://www.plivo.com/docs/voice/api/recording#retrieve-a-recording) and [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)
- Added `rounded_duration` parameter as a filter option for [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)

## [v4.43.0](https://github.com/plivo/plivo-php/tree/v4.43.0) (2023-03-03)
- Add `isDomestic` 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)

## [4.42.1](https://github.com/plivo/plivo-php/tree/v4.42.1) (2023-02-28)
-Added Exception handling for Retrieve all Calls API [Retrieve details of all calls](https://www.plivo.com/docs/voice/api/call#retrieve-all-calls)

## [4.42.0](https://github.com/plivo/plivo-php/tree/v4.42.0) (2023-02-27)
**Feature - Enhance MDR filtering capabilities **
- Added new fields on MDR object response
Expand Down
42 changes: 27 additions & 15 deletions src/Plivo/Resources/Call/CallInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,28 @@ public function getQueued($queuedCallUuid)
* + [string] subaccount - The id of the subaccount, if call details of the subaccount are needed.
* + [string] call_direction - Filter the results by call direction. The valid inputs are inbound and outbound.
* + [string] from_number - Filter the results by the number from where the call originated. For example:<br />
To filter out those numbers that contain a particular number sequence, use from_number={sequence}<br />
To filter out a number that matches an exact number, use from_number={exact_number}
* To filter out those numbers that contain a particular number sequence, use from_number={sequence}<br />
* To filter out a number that matches an exact number, use from_number={exact_number}
* + [string] to_number - Filter the results by the number to which the call was made. Tips to use this filter are:<br />
To filter out those numbers that contain a particular number sequence, use to_number={sequence}<br />
To filter out a number that matches an exact number, use to_number={exact_number}
* To filter out those numbers that contain a particular number sequence, use to_number={sequence}<br />
* To filter out a number that matches an exact number, use to_number={exact_number}
* + [string] bill_duration - Filter the results according to billed duration. The value of billed duration is in seconds. The filter can be used in one of the following five forms:<br />
bill_duration: Input the exact value. E.g., to filter out calls that were exactly three minutes long, use bill_duration=180<br />
bill_duration\__gt: gt stands for greater than. E.g., to filter out calls that were more than two hours in duration bill_duration\__gt=7200<br />
bill_duration\__gte: gte stands for greater than or equal to. E.g., to filter out calls that were two hours or more in duration bill_duration\__gte=7200<br />
bill_duration\__lt: lt stands for lesser than. E.g., to filter out calls that were less than seven minutes in duration bill_duration\__lt=420<br />
bill_duration\__lte: lte stands for lesser than or equal to. E.g., to filter out calls that were two hours or less in duration bill_duration\__lte=7200
* bill_duration: Input the exact value. E.g., to filter out calls that were exactly three minutes long, use bill_duration=180<br />
* bill_duration\__gt: gt stands for greater than. E.g., to filter out calls that were more than two hours in duration bill_duration\__gt=7200<br />
* bill_duration\__gte: gte stands for greater than or equal to. E.g., to filter out calls that were two hours or more in duration bill_duration\__gte=7200<br />
* bill_duration\__lt: lt stands for lesser than. E.g., to filter out calls that were less than seven minutes in duration bill_duration\__lt=420<br />
* bill_duration\__lte: lte stands for lesser than or equal to. E.g., to filter out calls that were two hours or less in duration bill_duration\__lte=7200
* + [string] end_time - Filter out calls according to the time of completion. The filter can be used in the following five forms:<br />
end_time: The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended at 2012-03-21 11:47[:30], use end_time=2012-03-21 11:47[:30]<br />
end_time\__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after 2012-03-21 11:47, use end_time\__gt=2012-03-21 11:47<br />
end_time\__gte: gte stands for greater than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after or exactly at 2012-03-21 11:47[:30], use end_time\__gte=2012-03-21 11:47[:30]<br />
end_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47<br />
end_time\__lte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30]
Note: The above filters can be combined to get calls that ended in a particular time range. The timestamps need to be UTC timestamps.
* end_time: The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended at 2012-03-21 11:47[:30], use end_time=2012-03-21 11:47[:30]<br />
* end_time\__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after 2012-03-21 11:47, use end_time\__gt=2012-03-21 11:47<br />
* end_time\__gte: gte stands for greater than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after or exactly at 2012-03-21 11:47[:30], use end_time\__gte=2012-03-21 11:47[:30]<br />
* end_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47<br />
* end_time\__lte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30]
* Note: The above filters can be combined to get calls that ended in a particular time range. The timestamps need to be UTC timestamps.
* + [int] limit - Used to display the number of results per page. The maximum number of results that can be fetched is 20.
* + [int] offset - Denotes the number of value items by which the results should be offset. E.g., If the result contains a 1000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.
* @return CallList
* @throws PlivoResponseException
*/
public function getList(array $optionalArgs = [])
{
Expand All @@ -234,6 +235,17 @@ public function getList(array $optionalArgs = [])

$calls = [];

$responseContents = $response->getContent();
if(array_key_exists("error",$responseContents)){
throw new PlivoResponseException(
$responseContents['error'],
0,
null,
$response->getContent(),
$response->getStatusCode()
);
}

foreach ($response->getContent()['objects'] as $call) {
$newCall = new Call($this->client, $call, $this->pathParams['authId'], $call['call_uuid']);

Expand Down
6 changes: 6 additions & 0 deletions src/Plivo/Resources/Message/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @property ?string $errorCode
* @property ?string $powerpackID
* @property ?string $requesterIP
* @property ?bool $isDomestic
*/
class Message extends Resource
{
Expand Down Expand Up @@ -70,10 +71,15 @@ public function __construct(
if (!empty($response['tendlc_campaign_id'])) {
$this->properties['tendlc_campaign_id'] = $response['tendlc_campaign_id'];
}

if (!empty($response['tendlc_registration_status'])) {
$this->properties['tendlc_registration_status'] = $response['tendlc_registration_status'];
}

if (isset($response['is_domestic'])){
$this->properties['isDomestic'] = $response['is_domestic'];
}

$this->pathParams = [
'authId' => $authId,
'messageUuid' => $response['message_uuid']
Expand Down
5 changes: 4 additions & 1 deletion src/Plivo/Resources/Recording/Recording.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ function __construct(BaseClient $client, array $response, $authId)
'recordingId' => $response['recording_id'],
'resourceUri' => $response['resource_uri'],
'fromNumber' => $response['from_number'],
'toNumber' => $response['to_number']
'toNumber' => $response['to_number'],
'cost' => $response['cost'],
'roundedDuration' => $response['rounded_duration'],
'daysOfStorage' => $response['days_of_storage']
];

$this->pathParams = [
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class Version
/**
* @const int PHP helper library minor version number
*/
const MINOR = 42;
const MINOR = 43;

/**
* @const int PHP helper library patch number
*/
const PATCH = 0;
const PATCH = 1;
/**
* @return string
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Mocks/messageGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"total_rate": "0.00250",
"units": 1,
"powerpack_id": "15c01cc2-4b9f-4d3b-bd15-3c4b38984cc4",
"requester_ip": "192.168.1.1"
"requester_ip": "192.168.1.1",
"is_domestic": false
}
60 changes: 40 additions & 20 deletions tests/Mocks/messageListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.1"
"requester_ip": "192.168.1.1",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -35,7 +36,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.2"
"requester_ip": "192.168.1.2",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -50,7 +52,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.3"
"requester_ip": "192.168.1.3",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -65,7 +68,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.4"
"requester_ip": "192.168.1.4",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -80,7 +84,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.5"
"requester_ip": "192.168.1.5",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -95,7 +100,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.6"
"requester_ip": "192.168.1.6",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -110,7 +116,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.7"
"requester_ip": "192.168.1.7",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -125,7 +132,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.8"
"requester_ip": "192.168.1.8",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -140,7 +148,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.9"
"requester_ip": "192.168.1.9",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -155,7 +164,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.10"
"requester_ip": "192.168.1.10",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -170,7 +180,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.11"
"requester_ip": "192.168.1.11",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -185,7 +196,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.12"
"requester_ip": "192.168.1.12",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -200,7 +212,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.13"
"requester_ip": "192.168.1.13",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -215,7 +228,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.14"
"requester_ip": "192.168.1.14",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -230,7 +244,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.15"
"requester_ip": "192.168.1.15",
"is_domestic": false
},
{
"error_code": null,
Expand All @@ -245,7 +260,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.16"
"requester_ip": "192.168.1.16",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -260,7 +276,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.17"
"requester_ip": "192.168.1.17",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -275,7 +292,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.18"
"requester_ip": "192.168.1.18",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -290,7 +308,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.19"
"requester_ip": "192.168.1.19",
"is_domestic": false
},
{
"error_code": "000",
Expand All @@ -305,7 +324,8 @@
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1,
"requester_ip": "192.168.1.20"
"requester_ip": "192.168.1.20",
"is_domestic": false
}
]
}
5 changes: 4 additions & 1 deletion tests/Mocks/recordingGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-11e4-a664-0026b945b52x.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/",
"from_number": "+919999323467",
"to_number": "+919891865130"
"to_number": "+919891865130",
"cost": "0.0004",
"rounded_duration": "120",
"days_of_storage": "209"
}
15 changes: 12 additions & 3 deletions tests/Mocks/recordingListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-1124-a664-0026b945b522.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/",
"from_number": "+919999323467",
"to_number": "+919891865130"
"to_number": "+919891865130",
"cost": "0.0004",
"rounded_duration": "120",
"days_of_storage": "209"
},
{
"add_time": "2014-08-05 16:05:21.993853+05:30",
Expand All @@ -36,7 +39,10 @@
"recording_url": "http://s3.amazonaws.com/recordings_2013/fc2716b0-1c8b-11e4-bwad-842b2b17453e.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/",
"from_number": "+919999323467",
"to_number": "+919891865130"
"to_number": "+919891865130",
"cost": "0.0004",
"rounded_duration": "120",
"days_of_storage": "209"
},
{
"add_time": "2014-08-05 15:51:56.582492+05:30",
Expand All @@ -51,7 +57,10 @@
"recording_url": "http://s3.amazonaws.com/recordings_2013/3e701c9e-1c8a-11e4-bwad-842b2b17453e.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/3e701c9e-1c8a-11e4-bwad-842b2b17453e/",
"from_number": "+919999323467",
"to_number": "+919891865130"
"to_number": "+919891865130",
"cost": "0.0004",
"rounded_duration": "120",
"days_of_storage": "209"
}
]
}