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 #287

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .github/workflows/unitTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x]
node-version: [11.x, 12.x, 13.x, 14.x, 15.x, 16.x]

steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Change Log
## [4.42.1](https://github.com/plivo/plivo-java/tree/v4.42.1) (2023-03-08)
**Feature - Parameters added to Recordings API**
- Added `cost`, `roundedDuration`, and `daysOfStorage` 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 `roundedDuration` parameter as a filter option for [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)

## [4.42.0](https://github.com/plivo/plivo-node/tree/v4.42.0) (2023-03-07)
**Bug fix - 'text' parameter should be optional for MMS**
- Make `text` as an optional parameter for [sending MMS](https://www.plivo.com/docs/sms/api/message#send-a-message).
- Fix code breaking due to undefined error.response while accessing response `status` property.

## [4.41.0](https://github.com/plivo/plivo-node/tree/v4.41.0) (2023-03-03)
**Adding new attribute - 'isDomestic' in Get Message and List Message APIs**
- 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.40.0](https://github.com/plivo/plivo-node/tree/v4.40.0) (2023-02-23)
**Feature - Enhance MDR filtering capabilities **
- Added new fields on MDR object response
Expand Down
7 changes: 2 additions & 5 deletions lib/resources/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class MessageGetResponse {
this.tendlcRegistrationStatus = params.tendlcRegistrationStatus;
this.destinationCountryIso2 = params.destinationCountryIso2;
this.requesterIP = params.requesterIp;
this.isDomestic = params.isDomestic;
}
}

Expand All @@ -72,6 +73,7 @@ export class MessageListResponse {
this.tendlcRegistrationStatus = params.tendlcRegistrationStatus;
this.destinationCountryIso2 = params.destinationCountryIso2;
this.requesterIP = params.requesterIp;
this.isDomestic = params.isDomestic;
}
}

Expand Down Expand Up @@ -210,11 +212,6 @@ export class MessageInterface extends PlivoResourceInterface {
value: dst,
validators: ['isRequired']
},
{
field: 'text',
value: text,
validators: ['isRequired']
},
]);

if (errors) {
Expand Down
7 changes: 7 additions & 0 deletions lib/resources/recordings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export class RetrieveRecordingResponse {
this.resourceUri = params.resourceUri;
this.fromNumber = params.fromNumber;
this.toNumber = params.toNumber;
this.cost = params.cost;
this.roundedDuration = params.roundedDuration;
this.daysOfStorage = params.daysOfStorage;
}
}

Expand All @@ -52,6 +55,9 @@ export class ListRecordingResponse {
this.mpcName = params.mpcName;
this.conferenceUuid = params.conferenceUuid;
this.mpcUuid = params.mpcUuid;
this.cost = params.cost;
this.roundedDuration = params.roundedDuration;
this.daysOfStorage = params.daysOfStorage;
}
}

Expand Down Expand Up @@ -156,6 +162,7 @@ export class RecordingInterface extends PlivoResourceInterface {
* @param {string} [params.addTime] - Filter based on the timings they were added
* @param {string} [params.limit] - Display no of results per page
* @param {string} [params.offset] - No of value items by which results should be offset
* @param {string} [params.roundedDuration] - Rounded duration of recording in seconds. valid values - multiples of 60
*/
list(params = {}) {
params.isVoiceRequest = 'true';
Expand Down
2 changes: 1 addition & 1 deletion lib/rest/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function Axios(config) {
let counter = 0;
axios.interceptors.response.use(null, (error) => {
const config = error.config;
if (counter < max_time && error.response.status >= 500) {
if (counter < max_time && error.response && error.response.status >= 500) {
counter++;
config.url = options.urls[counter] + options.authId + '/' + options.action;
return new Promise((resolve) => {
Expand Down
16 changes: 10 additions & 6 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,8 @@ export function Request(config) {
total_amount: '0.00000',
total_rate: '0.00350',
units: 1,
requester_ip: "192.168.1.1"
requester_ip: "192.168.1.1",
is_domestic: false
}
});
}
Expand Down Expand Up @@ -1784,14 +1785,14 @@ export function Request(config) {
}
});
}
else if (action=='NumberPool/659c7f88-c819-46e2-8af4-2d8a84249099/Shortcode/4444444/' && method == 'GET'){
else if (action=='NumberPool/659c7f88-c819-46e2-8af4-2d8a84249099/Shortcode/444444/' && method == 'GET'){
resolve({
response: {},
body: {
added_on: '2019-09-03T08:50:09.578928Z',
country_iso2: 'CA',
number_pool_uuid: '659c7f88-c819-46e2-8af4-2d8a84249099',
shortcode: '444444'
shortCode: '444444'
}
});
}
Expand Down Expand Up @@ -1938,7 +1939,8 @@ export function Request(config) {
total_amount: '0.00000',
total_rate: '0.00350',
units: 1,
requester_ip: '192.168.1.2'
requester_ip: '192.168.1.2',
is_domestic: false
}
});
}
Expand Down Expand Up @@ -1967,7 +1969,8 @@ export function Request(config) {
total_amount: '0.00000',
total_rate: '0.00350',
units: 1,
requester_ip: "192.168.1.1"
requester_ip: "192.168.1.1",
is_domestic: false
},
{
error_code: '200',
Expand All @@ -1982,7 +1985,8 @@ export function Request(config) {
total_amount: '0.00000',
total_rate: '0.00350',
units: 1,
requester_ip: "192.168.1.2"
requester_ip: "192.168.1.2",
is_domestic: false
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plivo",
"version": "4.40.0",
"version": "4.42.1",
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
"homepage": "https://github.com/plivo/plivo-node",
"files": [
Expand Down Expand Up @@ -63,7 +63,7 @@
"https-proxy-agent": "^5.0.0",
"build-url": "^1.0.10",
"form-data": "^4.0.0",
"jsonwebtoken": "^8.5.1",
"jsonwebtoken": "^9.0.0",
"lodash": "^4.17.4",
"querystring": "^0.2.0",
"uri-parser": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions test/powerpacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ describe('PowerpackInterface', function () {
it('find shortcode via interface', function () {
client.powerpacks.get("5ec4c8c9-cd74-42b5-9e41-0d7670d6bb46").then(
function (powerpack) {
return powerpack.find_shortcode('4444444')
return powerpack.find_shortcode('444444')
}).then(function (ppk) {
assert.equal(ppk.shortcode, "4444444")
assert.equal(ppk.shortCode, "444444")
});
});
it('list shortcode via interface', function () {
client.powerpacks.get("5ec4c8c9-cd74-42b5-9e41-0d7670d6bb46").then(
function (powerpack) {
return powerpack.list_shortcodes('4444444')
return powerpack.list_shortcodes('444444')
})
.then(function (result) {
assert.notEqual(result.length, 0)
Expand Down
2 changes: 2 additions & 0 deletions types/resources/messages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class MessageGetResponse {
units: string;
powerpackId: string;
requesterIp: string;
isDomestic: boolean;
}
export class MessageListResponse {
constructor(params: object);
Expand All @@ -39,6 +40,7 @@ export class MessageListResponse {
units: string;
powerpackId: string;
requesterIp: string;
isDomestic: boolean;
}
export class MMSMediaResponse {
constructor(params: object);
Expand Down