mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-09 22:08:40 -06:00
commit
f3e6d9e360
14 changed files with 93 additions and 25 deletions
|
|
@ -1,5 +1,9 @@
|
|||
# Change Log
|
||||
|
||||
## [v4.21.0](https://github.com/plivo/plivo-node/tree/v4.21.0) (2021-08-05)
|
||||
- Fixed a Typescript warning about base interpretation.
|
||||
- Add retrievable object responses support for [Retrieve a Power pack API](https://www.plivo.com/docs/sms/api/powerpack#retrieve-a-powerpack).
|
||||
|
||||
## [v4.20.1](https://github.com/plivo/plivo-node/tree/v4.20.1) (2021-07-27)
|
||||
- Updates to [add a member a multi-party call API](https://www.plivo.com/docs/voice/api/multiparty-call/participants#add-a-participant).
|
||||
- Remove validation range for `delay` and `ringtimeout` parameters.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
PlivoGenericResponse,
|
||||
PlivoResource,
|
||||
PlivoResourceInterface
|
||||
} from '../base';
|
||||
|
|
@ -271,7 +272,15 @@ export class NumberInterface extends PlivoResourceInterface {
|
|||
params.carrier = carrier;
|
||||
params.region = region;
|
||||
|
||||
return super.create(params);
|
||||
return new Promise((resolve, reject) => {
|
||||
client('POST', action, params)
|
||||
.then(response => {
|
||||
resolve(new PlivoGenericResponse(response.body, idField));
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,6 +40,22 @@ export class CreatePowerpackResponse {
|
|||
}
|
||||
}
|
||||
|
||||
export class RetrievePowerpack {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.applicationId = params.applicationId;
|
||||
this.applicationType = params.applicationType;
|
||||
this.createdOn = params.createdOn;
|
||||
this.localConnect = params.localConnect;
|
||||
this.name = params.name;
|
||||
this.numberPool = params.numberPool;
|
||||
this.numberPriority = params.numberPriority;
|
||||
this.stickySender = params.stickySender;
|
||||
this.uuid = params.uuid;
|
||||
}
|
||||
}
|
||||
|
||||
export class UpdatePowerpackResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
|
|
@ -696,9 +712,32 @@ export class PowerpackInterface extends PlivoResourceInterface {
|
|||
* @promise {object} return {@link Powerpack} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(uuid) {
|
||||
return super.get(uuid);
|
||||
get(uuid) {
|
||||
let errors = validate([{
|
||||
field: 'uuid',
|
||||
value: uuid,
|
||||
validators: ['isRequired']
|
||||
}]);
|
||||
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
if (action !== '' && !uuid) {
|
||||
reject(new Error(this[idKey] + ' must be set'));
|
||||
}
|
||||
client('GET', action + (uuid ? uuid + '/' : ''))
|
||||
.then(response => {
|
||||
resolve(new RetrievePowerpack(response.body, client));
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* create Powerpack
|
||||
* @method
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import request from 'request';
|
||||
import queryString from 'querystring';
|
||||
import request from 'request';
|
||||
|
||||
export function Request(config) {
|
||||
let auth = 'Basic ' + new Buffer(config.authId + ':' + config.authToken)
|
||||
|
|
@ -1465,4 +1465,4 @@ export function Request(config) {
|
|||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
import request from 'request';
|
||||
import queryString from 'querystring';
|
||||
import * as Exceptions from '../utils/exceptions';
|
||||
import * as _ from "lodash";
|
||||
|
||||
import queryString from 'querystring';
|
||||
import request from 'request';
|
||||
|
||||
export function Request(config) {
|
||||
let auth = 'Basic ' + new Buffer(config.authId + ':' + config.authToken)
|
||||
.toString('base64');
|
||||
|
|
@ -219,4 +220,4 @@ export function Request(config) {
|
|||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -5591,4 +5591,4 @@
|
|||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "plivo",
|
||||
"version": "4.20.1",
|
||||
"version": "4.21.0",
|
||||
"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": [
|
||||
|
|
|
|||
12
types/base.d.ts
vendored
12
types/base.d.ts
vendored
|
|
@ -4,8 +4,8 @@ export class PlivoGenericResponse {
|
|||
}
|
||||
export class PlivoResource {
|
||||
constructor(action: string, Klass: Symbol, idField: string, request: any);
|
||||
update(params: object, id: string): Promise<any>;
|
||||
delete(params: object): Promise<any>;
|
||||
// update(params: any, id: any): Promise<any>;
|
||||
delete(params: any): Promise<any>;
|
||||
executeAction(task: string, method: string, params: {}, action: string): Promise<any>;
|
||||
customexecuteAction(url: string, method?: string, params?: {}): Promise<any>;
|
||||
customexecuteGetNumberAction(url: string, method?: string, params?: {}): any;
|
||||
|
|
@ -13,7 +13,7 @@ export class PlivoResource {
|
|||
}
|
||||
export class PlivoResourceInterface {
|
||||
constructor(action: string, Klass: Symbol, idField: string, request: any);
|
||||
get(id: string, params?: {}): Promise<any>;
|
||||
list(params: object): Promise<any>;
|
||||
create(params: object): Promise<any>;
|
||||
}
|
||||
// get(id: any, params?: {}): Promise<any>;
|
||||
// create(params: any): Promise<any>;
|
||||
list(params: any): Promise<any>;
|
||||
}
|
||||
2
types/resources/endUsers.d.ts
vendored
2
types/resources/endUsers.d.ts
vendored
|
|
@ -29,7 +29,7 @@ export class ListEndUsersResponse {
|
|||
constructor(params: object);
|
||||
apiId: string;
|
||||
meta: Object;
|
||||
objects: Array;
|
||||
objects: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
2
types/resources/media.d.ts
vendored
2
types/resources/media.d.ts
vendored
|
|
@ -42,7 +42,7 @@ export class MediaInterface extends PlivoResourceInterface {
|
|||
* @method
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
upload(files: Array): Promise<UploadMediaResponse>;
|
||||
upload(files: Array<string>): Promise<UploadMediaResponse>;
|
||||
/**
|
||||
* Get Media by given id
|
||||
* @method
|
||||
|
|
|
|||
6
types/resources/messages.d.ts
vendored
6
types/resources/messages.d.ts
vendored
|
|
@ -23,7 +23,7 @@ export class MessageGetResponse {
|
|||
}
|
||||
export class MessageListResponse {
|
||||
constructor(params: object);
|
||||
errorCode: string;
|
||||
errorCode: string;
|
||||
fromNumber: string;
|
||||
messageDirection: string;
|
||||
messageState: string;
|
||||
|
|
@ -34,7 +34,7 @@ export class MessageListResponse {
|
|||
toNumber: string;
|
||||
totalAmount: string;
|
||||
totalRate: string;
|
||||
units: string;
|
||||
units: string;
|
||||
powerpackId: string;
|
||||
}
|
||||
export class MMSMediaResponse {
|
||||
|
|
@ -90,7 +90,7 @@ export class MessageInterface extends PlivoResourceInterface {
|
|||
type: string;
|
||||
url: string;
|
||||
method: string;
|
||||
media_urls: Array;
|
||||
media_urls: Array<string>;
|
||||
log: boolean;
|
||||
}): Promise < MessageResponse > ;
|
||||
/**
|
||||
|
|
|
|||
19
types/resources/powerpacks.d.ts
vendored
19
types/resources/powerpacks.d.ts
vendored
|
|
@ -17,6 +17,21 @@ export class CreatePowerpackResponse {
|
|||
stickySender: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export class RetrievePowerpack {
|
||||
constructor(params: object);
|
||||
apiId: string;
|
||||
applicationId: string;
|
||||
applicationType: string;
|
||||
createdOn: string;
|
||||
localConnect: string;
|
||||
name: string;
|
||||
numberPool: string;
|
||||
numberPriority: object;
|
||||
stickySender: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export class UpdatePowerpackResponse {
|
||||
constructor(params: object);
|
||||
apiId: string;
|
||||
|
|
@ -179,7 +194,7 @@ export class PowerpackInterface extends PlivoResourceInterface {
|
|||
* @promise {object} return {@link Powerpack} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(uuid: string): any;
|
||||
get(uuid: string): Promise<RetrievePowerpack>;
|
||||
/**
|
||||
* create Powerpack
|
||||
* @method
|
||||
|
|
@ -189,7 +204,7 @@ export class PowerpackInterface extends PlivoResourceInterface {
|
|||
* @param {string} [params.local_connect]
|
||||
* @param {string} [params.application_type]
|
||||
* @param {string} [params.application_id]
|
||||
* @promise {object} return {@link PlivoGenericResponse} object
|
||||
* @promise {object} return {@link RetrievePowerpack} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(name: string, params?: {}): Promise<CreatePowerpackResponse>;
|
||||
|
|
|
|||
2
types/rest/request-test.d.ts
vendored
2
types/rest/request-test.d.ts
vendored
|
|
@ -1 +1 @@
|
|||
export function Request(config: any): (method: string, action: string, params: object) => Promise<any>;
|
||||
export function Request(config: any): (method: string, action: string, params: object) => Promise<any>;
|
||||
2
types/rest/request.d.ts
vendored
2
types/rest/request.d.ts
vendored
|
|
@ -1 +1 @@
|
|||
export function Request(config: any): (method: string, action: string, params: object) => Promise<any>;
|
||||
export function Request(config: any): (method: string, action: string, params: object) => Promise<any>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue