diff --git a/lib/resources/Accounts.js b/lib/resources/Accounts.js index fa4dca4d80..7650026726 100644 --- a/lib/resources/Accounts.js +++ b/lib/resources/Accounts.js @@ -65,7 +65,13 @@ module.exports = function (client) { ['GET','POST','DELETE',{update:'POST'}], ['GET','POST',{create:'POST'}] ) + }, + sip:{ + domains:require('./sip/Domains')(client, sid), + ipAccessControlLists:require('./sip/IpAccessControlLists')(client,sid), + credentialLists:require('./sip/CredentialLists')(client,sid) } + }; //Add resources to Accounts.* or Accounts(sid).* diff --git a/lib/resources/sip/CredentialLists.js b/lib/resources/sip/CredentialLists.js new file mode 100644 index 0000000000..800b864e63 --- /dev/null +++ b/lib/resources/sip/CredentialLists.js @@ -0,0 +1,36 @@ +/** + @module resources/sip/CredentialLists + The Twilio "CredentialLists" Resource. + */ +var generate = require('../generate'), + ListInstanceResource = require('../ListInstanceResource'); + +module.exports = function (client, accountSid) { + var baseResourceUrl = '/Accounts/' + accountSid + '/SIP/CredentialLists'; + + //Instance requests + function CredentialLists(sid) { + var resourceApi = {} + + generate.restFunctions(resourceApi, client, + ['GET', 'POST', 'DELETE', {update: 'POST'}], + baseResourceUrl + '/' + sid + ); + + resourceApi.credentials = ListInstanceResource(client, accountSid, + 'SIP/CredentialLists/' + sid + '/Credentials', + ['GET', 'POST', 'DELETE', {update: 'POST'}], + ['GET', 'POST', {list: 'GET'}, {create: 'POST'}] + ); + + return resourceApi; + } + + generate.restFunctions(CredentialLists, client, + ['GET', 'POST', {create: 'POST'}, {list: 'GET'}], + baseResourceUrl + ); + + return CredentialLists; + +} diff --git a/lib/resources/sip/Domains.js b/lib/resources/sip/Domains.js new file mode 100644 index 0000000000..9b29921311 --- /dev/null +++ b/lib/resources/sip/Domains.js @@ -0,0 +1,41 @@ +/** + @module resources/sip/Domains + The Twilio "Domains" Resource. + */ +var generate = require('../generate'), + ListInstanceResource = require('../ListInstanceResource'); + +module.exports = function (client, accountSid) { + var baseResourceUrl = '/Accounts/' + accountSid + '/SIP/Domains'; + + //Instance requests + function Domains(sid) { + var resourceApi = {} + + generate.restFunctions(resourceApi, client, + ['GET', 'POST', 'DELETE', {update: 'POST'}], + baseResourceUrl + '/' + sid + ); + + resourceApi.ipAccessControlListMappings = ListInstanceResource(client, accountSid, + 'SIP/Domains/' + sid + '/IpAccessControlListMappings', + ['GET', 'DELETE'], + ['GET', 'POST', {create:'POST'}, {list: 'GET'}] + ); + + resourceApi.credentialListMappings = ListInstanceResource(client, accountSid, + 'SIP/Domains/' + sid + '/CredentialListMappings', + ['GET', 'DELETE'], + ['GET', 'POST', {create:'POST'}, {list: 'GET'}] + ); + + return resourceApi; + }; + + generate.restFunctions(Domains, client, + ['GET', 'POST', {create: 'POST'}, {list: 'GET'}], + baseResourceUrl + ); + + return Domains; +} diff --git a/lib/resources/sip/IpAccessControlLists.js b/lib/resources/sip/IpAccessControlLists.js new file mode 100644 index 0000000000..6988d7d3e3 --- /dev/null +++ b/lib/resources/sip/IpAccessControlLists.js @@ -0,0 +1,37 @@ +/** + @module resources/sip/IpAccessControlLists + The Twilio "IpAccessControlLists" Resource. + */ +var generate = require('../generate'), + ListInstanceResource = require('../ListInstanceResource'); + +module.exports = function (client, accountSid) { + var baseResourceUrl = '/Accounts/' + accountSid + '/SIP/IpAccessControlLists'; + + //Instance requests + function IpAccessControlLists(sid) { + var resourceApi = {} + + generate.restFunctions(resourceApi, client, + ['GET', 'POST', 'DELETE', {update: 'POST'}], + baseResourceUrl + '/' + sid + ); + + resourceApi.ipAddresses = ListInstanceResource(client, accountSid, + 'SIP/IpAccessControlLists/' + sid + '/IpAddresses', + ['GET', 'POST', 'DELETE', {update: 'POST'}], + ['GET', 'POST', {list: 'GET'}, {create: 'POST'}] + ); + + return resourceApi; + } + + generate.restFunctions(IpAccessControlLists, client, + ['GET', 'POST', {create: 'POST'}, {list: 'GET'}], + baseResourceUrl + ); + + + return IpAccessControlLists; + +}