callable-data-objects
v0.2.50
Published
Data transfer objects for the callable API
Downloads
36
Readme
Callable Management API
Getting Started
const url = "https://api-dev.control.callable.io";
const apiToken = "1234" //retrieved via oauth
const api = new CallableAPI(url, apiToken);
User
const { user } = api;
//Get logged in user
const me = user.me();
Managing Accounts
const { account } = api;
//List Accounts
const accounts = await account.list();
const acc = accounts.get(0);
//List DDIs
const ddis = await account.ddi(acc.id).list();
//List Trunks
const trunks = await account.trunk(acc.id).list();
//List Devices
const devices = await account.device(acc.id).list();
Validation
We use yup for validation
const newDevice = new Device({
name: "test",
extension: "100",
type: "ROUTE_START",
routeStart: {
...
}
})
//Check if valid
newDevice.isValid();
// Or validate
newDevice.validate();