mirror of
https://github.com/donl/plivo-node.git
synced 2026-05-25 22:07:10 -06:00
added support for hostedMessagingNumber and LOA
This commit is contained in:
parent
ee93816040
commit
46dbba603a
6 changed files with 724 additions and 2 deletions
222
lib/resources/hostedMessagingNumber.js
Normal file
222
lib/resources/hostedMessagingNumber.js
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
import {
|
||||
PlivoResource, PlivoResourceInterface
|
||||
} from '../base';
|
||||
import {
|
||||
extend, validate
|
||||
} from '../utils/common.js';
|
||||
|
||||
const clientKey = Symbol();
|
||||
const action = 'HostedMessagingNumber/';
|
||||
const idField = 'hosted_messaging_number_id';
|
||||
|
||||
export class HostedMessagingNumberResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.alias = params.alias;
|
||||
this.application = params.application
|
||||
this.failureReason = params.failureReason
|
||||
this.file = params.file;
|
||||
this.hostedMessagingNumberId = params.hostedMessagingNumberId;
|
||||
this.loaId = params.loaId;
|
||||
this.number = params.number;
|
||||
this.hostedStatus = params.hostedStatus;
|
||||
this.linkedNumbers = params.linkedNumbers;
|
||||
this.createdAt = params.createdAt;
|
||||
}
|
||||
}
|
||||
|
||||
export class CreateHostedMessagingNumberResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.alias = params.alias;
|
||||
this.application = params.application
|
||||
this.failureReason = params.failureReason
|
||||
this.file = params.file;
|
||||
this.hostedMessagingNumberId = params.hostedMessagingNumberId;
|
||||
this.loaId = params.loaId;
|
||||
this.number = params.number;
|
||||
this.hostedStatus = params.hostedStatus;
|
||||
this.linkedNumbers = params.linkedNumbers;
|
||||
this.createdAt = params.createdAt;
|
||||
}
|
||||
}
|
||||
|
||||
export class ListHostedMessagingNumberResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.meta = params.metaResponse;
|
||||
this.objects = params.objects;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class HostedMessagingNumber extends PlivoResource {
|
||||
constructor(client, data = {}) {
|
||||
super(action, HostedMessagingNumber, idField, client);
|
||||
if (idField in data) {
|
||||
this.id = data[idField];
|
||||
}
|
||||
this[clientKey] = client;
|
||||
extend(this, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* get HostedMessagingNumber by given id
|
||||
* @method
|
||||
* @param {string} id - id of the HostedMessagingNumber
|
||||
* @promise {object} return {@link HostedMessagingNumber} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id) {
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
if (action !== '' && !id) {
|
||||
reject(new Error(this[idKey] + ' must be set'));
|
||||
}
|
||||
client('GET', action + (id ? id + '/' : ''))
|
||||
.then(response => {
|
||||
let object = new HostedMessagingNumberResponse(response.body, client);
|
||||
Object.keys(object).forEach(key => object[key] === undefined && delete object[key]);
|
||||
resolve(object);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* list all HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params - params containing options to list HostedMessagingNumber by.
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.hostedStatus] - Hosted Status
|
||||
* @param {string} [params.number] - Phone Number
|
||||
* @param {string} [params.loaId] - LOA ID
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
list(params = {}) {
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
client('GET', action, params)
|
||||
.then(response => {
|
||||
resolve(new ListHostedMessagingNumberResponse(response.body, idField));
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.applicationId] - Application ID
|
||||
* @param {string} [params.number] - Phone Number
|
||||
* @param {string} [params.applicationId] - LOA ID
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params = {}) {
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
params.multipart = true;
|
||||
client('POST', action, params)
|
||||
.then(response => {
|
||||
let object = new CreateHostedMessagingNumberResponse(response.body, idField);
|
||||
Object.keys(object).forEach(key => object[key] === undefined && delete object[key]);
|
||||
resolve(object);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a HostedMessagingNumber interface
|
||||
* @constructor
|
||||
* @param {function} client - make api call
|
||||
* @param {object} [data] - data of call
|
||||
*/
|
||||
export class HostedMessagingNumberInterface extends PlivoResourceInterface {
|
||||
constructor(client, data = {}) {
|
||||
super(action, HostedMessagingNumber, idField, client);
|
||||
extend(this, data);
|
||||
this[clientKey] = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* get HostedMessagingNumber by given id
|
||||
* @method
|
||||
* @param {string} id - id of the HostedMessagingNumber
|
||||
* @promise {object} return {@link HostedMessagingNumber} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id) {
|
||||
let errors = validate([{field: 'id', value: id, validators: ['isRequired', 'isString']},]);
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
return new HostedMessagingNumber(this[clientKey], {id: idField}).get(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* list all HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params - params containing options to list HostedMessagingNumber by.
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.hostedStatus] - Hosted Status
|
||||
* @param {string} [params.number] - Phone Number
|
||||
* @param {string} [params.loaId] - LOA ID
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
list(params = {}) {
|
||||
const validations = []
|
||||
if (params.hasOwnProperty("alias")) {
|
||||
validations.push({field: 'alias', value: params.alias, validators: ['isString']})
|
||||
}
|
||||
if (params.hasOwnProperty("hostedStatus")) {
|
||||
validations.push({field: 'hostedStatus', value: params.hostedStatus, validators: ['isString']})
|
||||
}
|
||||
if (params.hasOwnProperty("number")) {
|
||||
validations.push({field: 'number', value: params.number, validators: ['isString']})
|
||||
}
|
||||
if (params.hasOwnProperty("loaId")) {
|
||||
validations.push({field: 'loaId', value: params.loaId, validators: ['isString']})
|
||||
}
|
||||
let errors = validate(validations);
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
return new HostedMessagingNumber(this[clientKey], {id: idField}).list(params)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.applicationId] - Application ID
|
||||
* @param {string} [params.number] - Phone Number
|
||||
* @param {string} [params.applicationId] - LOA ID
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params = {}) {
|
||||
let errors = validate([
|
||||
{field: 'alias', value: params.alias, validators: ['isRequired', 'isString']},
|
||||
{field: 'applicationId', value: params.applicationId, validators: ['isRequired', 'isString']},
|
||||
{field: 'loaId', value: params.loaId, validators: ['isRequired', 'isString']},
|
||||
{field: 'number', value: params.number, validators: ['isRequired', 'isString']},
|
||||
]);
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
return new HostedMessagingNumber(this[clientKey], {id: idField}).create(params)
|
||||
}
|
||||
}
|
||||
234
lib/resources/loa.js
Normal file
234
lib/resources/loa.js
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
import {
|
||||
PlivoResource, PlivoResourceInterface
|
||||
} from '../base';
|
||||
import {
|
||||
extend, validate
|
||||
} from '../utils/common.js';
|
||||
|
||||
const clientKey = Symbol();
|
||||
const action = 'HostedMessagingNumber/LOA/';
|
||||
const idField = 'loaID';
|
||||
|
||||
export class LOAResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.alias = params.alias;
|
||||
this.file = params.file;
|
||||
this.loaId = params.loaId;
|
||||
this.linkedNumbers = params.linkedNumbers;
|
||||
this.createdAt = params.createdAt;
|
||||
}
|
||||
}
|
||||
|
||||
export class CreateLOAResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.alias = params.alias;
|
||||
this.file = params.file;
|
||||
this.linkedNumbers = params.linkedNumbers;
|
||||
this.createdAt = params.createdAt;
|
||||
}
|
||||
}
|
||||
|
||||
export class ListLOAResponse {
|
||||
constructor(params) {
|
||||
params = params || {};
|
||||
this.apiId = params.apiId;
|
||||
this.meta = params.metaResponse;
|
||||
this.objects = params.objects;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class LOA extends PlivoResource {
|
||||
constructor(client, data = {}) {
|
||||
super(action, LOA, idField, client);
|
||||
if (idField in data) {
|
||||
this.id = data[idField];
|
||||
}
|
||||
this[clientKey] = client;
|
||||
extend(this, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* get LOA by given id
|
||||
* @method
|
||||
* @param {string} id - id of the LOA
|
||||
* @promise {object} return {@link LOA} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id) {
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
if (action !== '' && !id) {
|
||||
reject(new Error(this[idKey] + ' must be set'));
|
||||
}
|
||||
client('GET', action + (id ? id + '/' : ''))
|
||||
.then(response => {
|
||||
let object = new LOAResponse(response.body, client);
|
||||
Object.keys(object).forEach(key => object[key] === undefined && delete object[key]);
|
||||
resolve(object);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* list all LOA
|
||||
* @method
|
||||
* @param {object} params - params containing options to list LOA by.
|
||||
* @param {string} [params.alias] - Alias
|
||||
*/
|
||||
list(params = {}) {
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
client('GET', action, params)
|
||||
.then(response => {
|
||||
resolve(new ListLOAResponse(response.body, idField));
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an LOA
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.file] - File to be uploaded
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params = {}) {
|
||||
let client = this[clientKey];
|
||||
return new Promise((resolve, reject) => {
|
||||
params.multipart = true;
|
||||
client('POST', action, params)
|
||||
.then(response => {
|
||||
let object = new CreateLOAResponse(response.body, idField);
|
||||
Object.keys(object).forEach(key => object[key] === undefined && delete object[key]);
|
||||
resolve(object);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes an LOA
|
||||
* @method
|
||||
* @param {string} id - id to delete
|
||||
* @promise {boolean} return true if success
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
delete(id) {
|
||||
let client = this[clientKey];
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (action !== '' && !id) {
|
||||
reject(new Error(this[idKey] + ' must be set'));
|
||||
}
|
||||
client('DELETE', action + id + '/')
|
||||
.then(() => {
|
||||
resolve(true);
|
||||
})
|
||||
.catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a LOA interface
|
||||
* @constructor
|
||||
* @param {function} client - make api call
|
||||
* @param {object} [data] - data of call
|
||||
*/
|
||||
export class LOAInterface extends PlivoResourceInterface {
|
||||
constructor(client, data = {}) {
|
||||
super(action, LOA, idField, client);
|
||||
extend(this, data);
|
||||
this[clientKey] = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* get LOA by given id
|
||||
* @method
|
||||
* @param {string} id - id of the loa
|
||||
* @promise {object} return {@link LOA} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id) {
|
||||
let errors = validate([{field: 'id', value: id, validators: ['isRequired', 'isString']},]);
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
return new LOA(this[clientKey], {id: idField}).get(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* list all LOA
|
||||
* @method
|
||||
* @param {object} params - params containing options to list LOA by.
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
list(params = {}) {
|
||||
const validations = []
|
||||
if (params.hasOwnProperty("alias")) {
|
||||
validations.push({field: 'alias', value: params.alias, validators: ['isString']},)
|
||||
}
|
||||
let errors = validate(validations);
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
return new LOA(this[clientKey], {id: idField}).list(params)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an LOA
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.file] - File to be uploaded
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params = {}) {
|
||||
let errors = validate([{
|
||||
field: 'alias',
|
||||
value: params.alias,
|
||||
validators: ['isRequired', 'isString']
|
||||
}, {field: 'file', value: params.alias, validators: ['isRequired']}]);
|
||||
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
|
||||
return new LOA(this[clientKey], {id: idField}).create(params)
|
||||
}
|
||||
|
||||
/**
|
||||
* delete an LOA
|
||||
* @method
|
||||
* @param {string} id - id to delete
|
||||
* @promise {boolean} return true if success
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
delete(id) {
|
||||
let errors = validate([{
|
||||
field: 'id', value: id, validators: ['isRequired', "isString"]
|
||||
}]);
|
||||
|
||||
if (errors) {
|
||||
return errors;
|
||||
}
|
||||
return new LOA(this[clientKey], {id: idField}).delete(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,10 @@ import { ComplianceDocumentTypeInterface } from "../resources/complianceDocument
|
|||
import { ComplianceDocumentInterface} from "../resources/complianceDocuments";
|
||||
import { ComplianceRequirementInterface } from "../resources/complianceRequirements";
|
||||
import { ComplianceApplicationInterface } from "../resources/complianceApplications";
|
||||
import {MultiPartyCallInterface} from "../resources/multiPartyCall";
|
||||
import { MultiPartyCallInterface } from "../resources/multiPartyCall";
|
||||
import { LOAInterface } from "../resources/loa";
|
||||
import { HostedMessagingNumberInterface } from "../resources/hostedMessagingNumber";
|
||||
|
||||
|
||||
exports.Response = function() {
|
||||
return new Response();
|
||||
|
|
@ -102,6 +105,8 @@ export class Client {
|
|||
this.complianceRequirements = new ComplianceRequirementInterface(client);
|
||||
this.complianceApplications = new ComplianceApplicationInterface(client);
|
||||
this.multiPartyCalls = new MultiPartyCallInterface(client);
|
||||
this.loa = new LOAInterface(client);
|
||||
this.hostedMessagingNumber = new HostedMessagingNumberInterface(client);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
|
|
|||
123
types/resources/hostedMessagingNumber.d.ts
vendored
Normal file
123
types/resources/hostedMessagingNumber.d.ts
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
export class HostedMessagingNumberResponse {
|
||||
constructor(params: object);
|
||||
|
||||
apiId: string;
|
||||
loaId: string;
|
||||
alias: string;
|
||||
file: string;
|
||||
createdAt: string;
|
||||
linkedNumbers: Array<string>;
|
||||
}
|
||||
|
||||
export class CreateHostedMessagingNumberResponse {
|
||||
constructor(params: object);
|
||||
|
||||
apiId: string;
|
||||
loaId: string;
|
||||
alias: string;
|
||||
file: string;
|
||||
createdAt: string;
|
||||
linkedNumbers: string[];
|
||||
}
|
||||
|
||||
export class ListHostedMessagingNumberResponse {
|
||||
constructor(params: object);
|
||||
|
||||
apiId: string;
|
||||
meta: Object;
|
||||
objects: Array<Object>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a HostedMessagingNumber
|
||||
* @constructor
|
||||
* @param {function} client - make api call
|
||||
* @param {object} [data] - data of call
|
||||
*/
|
||||
export class HostedMessagingNumber extends PlivoResource {
|
||||
constructor(client: Function, data?: {});
|
||||
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* get HostedMessagingNumber by given id
|
||||
* @method
|
||||
* @param {string} id - id of the document
|
||||
* @promise {object} return {@link HostedMessagingNumber} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id: string): Promise<HostedMessagingNumberResponse>;
|
||||
|
||||
/**
|
||||
* list all HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params - params containing options to list HostedMessagingNumber by.
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.hostedStatus] - Hosted Status
|
||||
* @param {string} [params.number] - Phone Number
|
||||
* @param {string} [params.loaId] - LOA ID
|
||||
*/
|
||||
list(params: object): Promise<ListHostedMessagingNumberResponse>;
|
||||
|
||||
/**
|
||||
* Create a HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.file] - File to be uploaded
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params: object): Promise<CreateHostedMessagingNumberResponse>;
|
||||
|
||||
[clientKey]: symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a HostedMessagingNumber Interface
|
||||
* @constructor
|
||||
* @param {function} client - make api call
|
||||
* @param {object} [data] - data of call
|
||||
*/
|
||||
export class HostedMessagingNumberInterface extends PlivoResourceInterface {
|
||||
constructor(client: Function, data?: {});
|
||||
|
||||
/**
|
||||
* get HostedMessagingNumber by given id
|
||||
* @method
|
||||
* @param {string} id - id of the document
|
||||
* @promise {object} return {@link HostedMessagingNumber} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id: string): Promise<HostedMessagingNumberResponse>;
|
||||
|
||||
|
||||
/**
|
||||
* list all HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params - params containing options to list HostedMessagingNumber by.
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.hostedStatus] - Hosted Status
|
||||
* @param {string} [params.number] - Phone Number
|
||||
* @param {string} [params.loaId] - LOA ID
|
||||
*/
|
||||
list(params: object): Promise<ListHostedMessagingNumberResponse>;
|
||||
|
||||
/**
|
||||
* Create a HostedMessagingNumber
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.file] - File to be uploaded
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params: object): Promise<CreateHostedMessagingNumberResponse>;
|
||||
|
||||
[clientKey]: symbol;
|
||||
}
|
||||
|
||||
import {PlivoResource} from "../base";
|
||||
|
||||
declare const clientKey: unique symbol;
|
||||
import {PlivoResourceInterface} from "../base";
|
||||
|
||||
export {};
|
||||
134
types/resources/loa.d.ts
vendored
Normal file
134
types/resources/loa.d.ts
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
export class LOAResponse {
|
||||
constructor(params: object);
|
||||
|
||||
apiId: string;
|
||||
loaId: string;
|
||||
alias: string;
|
||||
file: string;
|
||||
createdAt: string;
|
||||
linkedNumbers: Array<string>;
|
||||
}
|
||||
|
||||
export class CreateLOAResponse {
|
||||
constructor(params: object);
|
||||
|
||||
apiId: string;
|
||||
loaId: string;
|
||||
alias: string;
|
||||
file: string;
|
||||
createdAt: string;
|
||||
linkedNumbers: string[];
|
||||
}
|
||||
|
||||
export class ListLOAResponse {
|
||||
constructor(params: object);
|
||||
|
||||
apiId: string;
|
||||
meta: Object;
|
||||
objects: Array<Object>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an LOA
|
||||
* @constructor
|
||||
* @param {function} client - make api call
|
||||
* @param {object} [data] - data of call
|
||||
*/
|
||||
export class LOA extends PlivoResource {
|
||||
constructor(client: Function, data?: {});
|
||||
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* get LOA by given id
|
||||
* @method
|
||||
* @param {string} id - id of the LOA
|
||||
* @promise {object} return {@link LOA} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id: string): Promise<LOAResponse>;
|
||||
|
||||
|
||||
/**
|
||||
* list all LOA
|
||||
* @method
|
||||
* @param {object} params - params containing options to list loa by.
|
||||
*/
|
||||
list(params: object): Promise<ListLOAResponse>;
|
||||
|
||||
/**
|
||||
* Create an LOA
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.file] - File array of the files to be uploaded
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params: object): Promise<CreateLOAResponse>;
|
||||
|
||||
/**
|
||||
* delete an LOA
|
||||
* @method
|
||||
* @param {string} id - id to delete
|
||||
* @promise {boolean} return true if success
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
delete(): Promise<unknown>;
|
||||
|
||||
[clientKey]: symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an LOA Interface
|
||||
* @constructor
|
||||
* @param {function} client - make api call
|
||||
* @param {object} [data] - data of call
|
||||
*/
|
||||
export class LOAInterface extends PlivoResourceInterface {
|
||||
constructor(client: Function, data?: {});
|
||||
|
||||
/**
|
||||
* get LOA by given id
|
||||
* @method
|
||||
* @param {string} id - id of the LOA
|
||||
* @promise {object} return {@link LOA} object
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
get(id: string): Promise<LOAResponse>;
|
||||
|
||||
|
||||
/**
|
||||
* list all LOA
|
||||
* @method
|
||||
* @param {object} params - params containing options to list loa by.
|
||||
*/
|
||||
list(params: object): Promise<ListLOAResponse>;
|
||||
|
||||
/**
|
||||
* Create an LOA
|
||||
* @method
|
||||
* @param {object} params
|
||||
* @param {string} [params.alias] - Alias
|
||||
* @param {string} [params.file] - File array of the files to be uploaded
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
create(params: object): Promise<CreateLOAResponse>;
|
||||
|
||||
/**
|
||||
* delete an LOA
|
||||
* @method
|
||||
* @param {string} id - id to delete
|
||||
* @promise {boolean} return true if success
|
||||
* @fail {Error} return Error
|
||||
*/
|
||||
delete(id: string): any;
|
||||
|
||||
[clientKey]: symbol;
|
||||
}
|
||||
|
||||
import {PlivoResource} from "../base";
|
||||
|
||||
declare const clientKey: unique symbol;
|
||||
import {PlivoResourceInterface} from "../base";
|
||||
|
||||
export {};
|
||||
6
types/rest/client.d.ts
vendored
6
types/rest/client.d.ts
vendored
|
|
@ -28,6 +28,8 @@ export class Client {
|
|||
complianceDocuments: ComplianceDocumentInterface;
|
||||
complianceRequirements: ComplianceRequirementInterface;
|
||||
complianceApplications: ComplianceApplicationInterface;
|
||||
loa: LOAInterface;
|
||||
hostedMessagingNumber: HostedMessagingNumberInterface;
|
||||
toJSON(...args: any[]): any;
|
||||
}
|
||||
/**
|
||||
|
|
@ -58,4 +60,6 @@ import { EndUserInterface } from "../resources/endUsers";
|
|||
import { ComplianceDocumentTypeInterface } from "../resources/complianceDocumentTypes";
|
||||
import { ComplianceDocumentInterface} from "../resources/complianceDocuments";
|
||||
import { ComplianceRequirementInterface } from "../resources/complianceRequirements";
|
||||
import { ComplianceApplicationInterface } from "../resources/complianceApplications";
|
||||
import { ComplianceApplicationInterface } from "../resources/complianceApplications";
|
||||
import { LOAInterface } from "../resources/loa";
|
||||
import { HostedMessagingNumberInterface } from "../resources/hostedMessagingNumber";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue