initial support for messages and applications

This commit is contained in:
Dave Horton committed 2021-02-22 18:04:06 -05:00
1 parent 0696fe0885
commit d383629ba4
9 files changed
+353 -190

No files matched your search

+22 -2
View File
@@ -106,9 +106,29 @@ const validateCallCreate = (opts) => {
if (hookStatusUrl) assert.ok(/^https?:/.test(hookStatusUrl), 'call_status_hook must be an absolute url');
};
const validateCallList = (opts) => {
};
const validateMessageCreate = (opts) => {
const {from, to, text} = opts;
assert.ok(from && typeof from === 'string', 'messages.create: from property is required');
assert.ok(to && typeof to === 'object', 'message.create: to property is required');
assert.ok(text && typeof text === 'object', 'message.create: text property is required');
};
module.exports = {
validate,
specs,
validateCallUpdate,
validateCallCreate
validators: {
Calls: {
create: validateCallCreate,
update: validateCallUpdate,
list: validateCallList
},
Messages: {
validateMessageCreate
}
}
};