我正在尝试确定是否存在twilio子帐户,但是twilioClient.api.accounts.each()函数仅在找到结果时返回,而在没有找到结果时返回。有人知道如何使用nodejs在twilio中执行子帐户的计数吗?
twilioClient.api.accounts.each({ friendlyName:“ xx” }, 功能(帐户){ console.log(“仅在找到帐户后才能到达。”); } );
答案 0 :(得分:0)
这里是Twilio开发人员的传播者。
列表资源的each
方法可以方便地遍历结果。如果只想列出项目,则应改用list
。
twilioClient.api.accounts.list({ friendlyName: 'xx' }, function(error, accounts){;
if (error) { console.error(error); returnl; }
console.log(`There are ${accounts.length} accounts called "x"`);
});