mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-30 06:12:08 -06:00
added examples for hostedMessagingNumber and loa
This commit is contained in:
parent
47bacf2bc4
commit
2dca4a96db
4 changed files with 79 additions and 0 deletions
35
examples/hostedMessagingNumber.js
Normal file
35
examples/hostedMessagingNumber.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
var Plivo = require('../dist/rest/client.js');
|
||||
var client = new Plivo.Client();
|
||||
|
||||
var createParams = {
|
||||
alias:"alias",
|
||||
applicationId: "applicationId",
|
||||
loaId:"loaID",
|
||||
number:"number"
|
||||
};
|
||||
|
||||
var listParams = {
|
||||
alias:"alias",
|
||||
applicationId: "applicationId",
|
||||
loaId:"loaID",
|
||||
number:"number",
|
||||
hostedStatus: "completed",
|
||||
};
|
||||
|
||||
|
||||
client.hostedMessagingNumber.create(createParams)
|
||||
.then(function (hmn) {
|
||||
console.log("\n============ created ===========\n", hmn)
|
||||
return client.hostedMessagingNumber.get(hmn.id);
|
||||
})
|
||||
.then(function (hmn) {
|
||||
console.log("\n============ get ===========\n", hmn)
|
||||
return client.hostedMessagingNumber.list(listParams)
|
||||
})
|
||||
.then(function (hmns) {
|
||||
console.log("\n============ list with params ===========\n", hmns)
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log("\n============ Error :: ===========\n", err);
|
||||
});
|
||||
|
||||
36
examples/loa.js
Normal file
36
examples/loa.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
var Plivo = require('../dist/rest/client.js');
|
||||
var client = new Plivo.Client();
|
||||
|
||||
var createParams = {
|
||||
"alias": "Test loa",
|
||||
"file": "path to file"
|
||||
|
||||
};
|
||||
|
||||
var listParams = {
|
||||
alias: "Test loa",
|
||||
limit: 10,
|
||||
offset: 5
|
||||
};
|
||||
|
||||
|
||||
client.loa.create(createParams)
|
||||
.then(function (loa) {
|
||||
console.log("\n============ created ===========\n", loa)
|
||||
return client.loa.get(loa.id);
|
||||
})
|
||||
.then(function (loa) {
|
||||
console.log("\n============ get ===========\n", loa)
|
||||
return client.loa.delete(loa.id);
|
||||
})
|
||||
.then(function (result) {
|
||||
console.log("\n============ deleted ===========\n", result)
|
||||
return client.loa.list(listParams)
|
||||
})
|
||||
.then(function (loas) {
|
||||
console.log("\n============ list with params ===========\n", loas)
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log("\n============ Error :: ===========\n", err);
|
||||
});
|
||||
|
||||
|
|
@ -61,6 +61,8 @@ import { ComplianceDocumentTypeInterface } from "../resources/complianceDocument
|
|||
import { ComplianceDocumentInterface} from "../resources/complianceDocuments";
|
||||
import { ComplianceRequirementInterface } from "../resources/complianceRequirements";
|
||||
import { ComplianceApplicationInterface } from "../resources/complianceApplications";
|
||||
import { LOAInterface } from "../resources/loa";
|
||||
import { HostedMessagingNumberInterface } from "../resources/hostedMessagingNumber";
|
||||
|
||||
export class Client {
|
||||
constructor(authId, authToken, proxy) {
|
||||
|
|
@ -111,6 +113,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
4
types/rest/client-test.d.ts
vendored
4
types/rest/client-test.d.ts
vendored
|
|
@ -13,6 +13,8 @@ export class Client {
|
|||
pricings: PricingInterface;
|
||||
recordings: RecordingInterface;
|
||||
media: MediaInterface;
|
||||
loa: LOAInterface;
|
||||
hostedMessagingNumber: HostedMessagingNumberInterface;
|
||||
}
|
||||
/**
|
||||
* Plivo API client which can be used to access the Plivo APIs.
|
||||
|
|
@ -37,3 +39,5 @@ import { PricingInterface } from "../resources/pricings.js";
|
|||
import { RecordingInterface } from "../resources/recordings.js";
|
||||
import { MediaInterface } from "../resources/media.js";
|
||||
import { Phlo } from "../resources/phlo.js";
|
||||
import { LOAInterface } from "../resources/loa.js";
|
||||
import { HostedMessagingNumberInterface } from "../resources/hostedMessagingNumber.js";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue