From f27fb59f5d215064c49a8d10b7a6d2eac9c5c049 Mon Sep 17 00:00:00 2001 From: ahung Date: Fri, 17 Dec 2021 11:29:52 -0700 Subject: [PATCH] fix: done callback execution when each method limit reached --- lib/rest/accounts/v1/credential/aws.js | 2 + lib/rest/accounts/v1/credential/publicKey.js | 2 + lib/rest/api/v2010/account.js | 2 + lib/rest/api/v2010/account/address.js | 2 + .../account/address/dependentPhoneNumber.js | 2 + lib/rest/api/v2010/account/application.js | 2 + .../api/v2010/account/authorizedConnectApp.js | 2 + .../api/v2010/account/availablePhoneNumber.js | 2 + .../account/availablePhoneNumber/local.js | 2 + .../availablePhoneNumber/machineToMachine.js | 2 + .../account/availablePhoneNumber/mobile.js | 2 + .../account/availablePhoneNumber/national.js | 2 + .../availablePhoneNumber/sharedCost.js | 2 + .../account/availablePhoneNumber/tollFree.js | 2 + .../account/availablePhoneNumber/voip.js | 2 + lib/rest/api/v2010/account/call.js | 2 + lib/rest/api/v2010/account/call/event.js | 2 + .../api/v2010/account/call/notification.js | 2 + lib/rest/api/v2010/account/call/recording.js | 2 + lib/rest/api/v2010/account/conference.js | 2 + .../v2010/account/conference/participant.js | 2 + .../api/v2010/account/conference/recording.js | 2 + lib/rest/api/v2010/account/connectApp.js | 2 + .../api/v2010/account/incomingPhoneNumber.js | 2 + .../incomingPhoneNumber/assignedAddOn.js | 2 + .../assignedAddOn/assignedAddOnExtension.js | 2 + .../account/incomingPhoneNumber/local.js | 2 + .../account/incomingPhoneNumber/mobile.js | 2 + .../account/incomingPhoneNumber/tollFree.js | 2 + lib/rest/api/v2010/account/key.js | 2 + lib/rest/api/v2010/account/message.js | 2 + lib/rest/api/v2010/account/message/media.js | 2 + lib/rest/api/v2010/account/notification.js | 2 + .../api/v2010/account/outgoingCallerId.js | 2 + lib/rest/api/v2010/account/queue.js | 2 + lib/rest/api/v2010/account/queue/member.js | 2 + lib/rest/api/v2010/account/recording.js | 2 + .../v2010/account/recording/addOnResult.js | 2 + .../account/recording/addOnResult/payload.js | 2 + .../v2010/account/recording/transcription.js | 2 + lib/rest/api/v2010/account/shortCode.js | 2 + lib/rest/api/v2010/account/signingKey.js | 2 + .../api/v2010/account/sip/credentialList.js | 2 + .../account/sip/credentialList/credential.js | 2 + lib/rest/api/v2010/account/sip/domain.js | 2 + .../authCallsCredentialListMapping.js | 2 + .../authCallsIpAccessControlListMapping.js | 2 + .../authRegistrationsCredentialListMapping.js | 2 + .../sip/domain/credentialListMapping.js | 2 + .../sip/domain/ipAccessControlListMapping.js | 2 + .../v2010/account/sip/ipAccessControlList.js | 2 + .../sip/ipAccessControlList/ipAddress.js | 2 + lib/rest/api/v2010/account/transcription.js | 2 + lib/rest/api/v2010/account/usage/record.js | 2 + .../api/v2010/account/usage/record/allTime.js | 2 + .../api/v2010/account/usage/record/daily.js | 2 + .../v2010/account/usage/record/lastMonth.js | 2 + .../api/v2010/account/usage/record/monthly.js | 2 + .../v2010/account/usage/record/thisMonth.js | 2 + .../api/v2010/account/usage/record/today.js | 2 + .../api/v2010/account/usage/record/yearly.js | 2 + .../v2010/account/usage/record/yesterday.js | 2 + lib/rest/api/v2010/account/usage/trigger.js | 2 + lib/rest/autopilot/v1/assistant.js | 2 + lib/rest/autopilot/v1/assistant/fieldType.js | 2 + .../v1/assistant/fieldType/fieldValue.js | 2 + lib/rest/autopilot/v1/assistant/modelBuild.js | 2 + lib/rest/autopilot/v1/assistant/query.js | 2 + lib/rest/autopilot/v1/assistant/task.js | 2 + lib/rest/autopilot/v1/assistant/task/field.js | 2 + .../autopilot/v1/assistant/task/sample.js | 2 + lib/rest/autopilot/v1/assistant/webhook.js | 2 + lib/rest/bulkexports/v1/export/day.js | 2 + .../bulkexports/v1/export/exportCustomJob.js | 2 + lib/rest/chat/v1/credential.js | 2 + lib/rest/chat/v1/service.js | 2 + lib/rest/chat/v1/service/channel.js | 2 + lib/rest/chat/v1/service/channel/invite.js | 2 + lib/rest/chat/v1/service/channel/member.js | 2 + lib/rest/chat/v1/service/channel/message.js | 2 + lib/rest/chat/v1/service/role.js | 2 + lib/rest/chat/v1/service/user.js | 2 + lib/rest/chat/v1/service/user/userChannel.js | 2 + lib/rest/chat/v2/credential.js | 2 + lib/rest/chat/v2/service.js | 2 + lib/rest/chat/v2/service/binding.js | 2 + lib/rest/chat/v2/service/channel.js | 2 + lib/rest/chat/v2/service/channel/invite.js | 2 + lib/rest/chat/v2/service/channel/member.js | 2 + lib/rest/chat/v2/service/channel/message.js | 2 + lib/rest/chat/v2/service/channel/webhook.js | 2 + lib/rest/chat/v2/service/role.js | 2 + lib/rest/chat/v2/service/user.js | 2 + lib/rest/chat/v2/service/user/userBinding.js | 2 + lib/rest/chat/v2/service/user/userChannel.js | 2 + lib/rest/conversations/v1/conversation.js | 2 + .../conversations/v1/conversation/message.js | 2 + .../conversation/message/deliveryReceipt.js | 2 + .../v1/conversation/participant.js | 2 + .../conversations/v1/conversation/webhook.js | 2 + lib/rest/conversations/v1/credential.js | 2 + .../v1/participantConversation.js | 2 + lib/rest/conversations/v1/role.js | 2 + lib/rest/conversations/v1/service.js | 2 + lib/rest/conversations/v1/service/binding.js | 2 + .../conversations/v1/service/conversation.js | 2 + .../v1/service/conversation/message.js | 2 + .../conversation/message/deliveryReceipt.js | 2 + .../v1/service/conversation/participant.js | 2 + .../v1/service/conversation/webhook.js | 2 + .../v1/service/participantConversation.js | 2 + lib/rest/conversations/v1/service/role.js | 2 + lib/rest/conversations/v1/service/user.js | 2 + .../v1/service/user/userConversation.js | 2 + lib/rest/conversations/v1/user.js | 2 + .../conversations/v1/user/userConversation.js | 2 + lib/rest/events/v1/eventType.js | 2 + lib/rest/events/v1/schema/version.js | 2 + lib/rest/events/v1/sink.js | 2 + lib/rest/events/v1/subscription.js | 2 + .../events/v1/subscription/subscribedEvent.js | 2 + lib/rest/fax/v1/fax.js | 2 + lib/rest/fax/v1/fax/faxMedia.js | 2 + lib/rest/flexApi/v1/channel.js | 2 + lib/rest/flexApi/v1/flexFlow.js | 2 + lib/rest/flexApi/v1/webChannel.js | 2 + lib/rest/insights/v1/call/event.js | 2 + lib/rest/insights/v1/call/metric.js | 2 + lib/rest/insights/v1/callSummaries.js | 2 + lib/rest/insights/v1/room.js | 2 + lib/rest/insights/v1/room/participant.js | 2 + lib/rest/ipMessaging/v1/credential.js | 2 + lib/rest/ipMessaging/v1/service.js | 2 + lib/rest/ipMessaging/v1/service/channel.js | 2 + .../ipMessaging/v1/service/channel/invite.js | 2 + .../ipMessaging/v1/service/channel/member.js | 2 + .../ipMessaging/v1/service/channel/message.js | 2 + lib/rest/ipMessaging/v1/service/role.js | 2 + lib/rest/ipMessaging/v1/service/user.js | 2 + .../v1/service/user/userChannel.js | 2 + lib/rest/ipMessaging/v2/credential.js | 2 + lib/rest/ipMessaging/v2/service.js | 2 + lib/rest/ipMessaging/v2/service/binding.js | 2 + lib/rest/ipMessaging/v2/service/channel.js | 2 + .../ipMessaging/v2/service/channel/invite.js | 2 + .../ipMessaging/v2/service/channel/member.js | 2 + .../ipMessaging/v2/service/channel/message.js | 2 + .../ipMessaging/v2/service/channel/webhook.js | 2 + lib/rest/ipMessaging/v2/service/role.js | 2 + lib/rest/ipMessaging/v2/service/user.js | 2 + .../v2/service/user/userBinding.js | 2 + .../v2/service/user/userChannel.js | 2 + lib/rest/media/v1/mediaProcessor.js | 2 + lib/rest/media/v1/playerStreamer.js | 2 + lib/rest/messaging/v1/brandRegistration.js | 2 + .../v1/brandRegistration/brandVetting.js | 2 + lib/rest/messaging/v1/service.js | 2 + lib/rest/messaging/v1/service/alphaSender.js | 2 + lib/rest/messaging/v1/service/phoneNumber.js | 2 + lib/rest/messaging/v1/service/shortCode.js | 2 + .../messaging/v1/service/usAppToPerson.js | 2 + lib/rest/monitor/v1/alert.js | 2 + lib/rest/monitor/v1/event.js | 2 + lib/rest/notify/v1/credential.js | 2 + lib/rest/notify/v1/service.js | 2 + lib/rest/notify/v1/service/binding.js | 2 + .../numbers/v2/regulatoryCompliance/bundle.js | 2 + .../regulatoryCompliance/bundle/evaluation.js | 2 + .../bundle/itemAssignment.js | 2 + .../v2/regulatoryCompliance/endUser.js | 2 + .../v2/regulatoryCompliance/endUserType.js | 2 + .../v2/regulatoryCompliance/regulation.js | 2 + .../supportingDocument.js | 2 + .../supportingDocumentType.js | 2 + lib/rest/preview/bulk_exports/export/day.js | 2 + .../bulk_exports/export/exportCustomJob.js | 2 + lib/rest/preview/deployed_devices/fleet.js | 2 + .../deployed_devices/fleet/certificate.js | 2 + .../deployed_devices/fleet/deployment.js | 2 + .../preview/deployed_devices/fleet/device.js | 2 + .../preview/deployed_devices/fleet/key.js | 2 + .../hosted_numbers/authorizationDocument.js | 2 + .../dependentHostedNumberOrder.js | 2 + .../hosted_numbers/hostedNumberOrder.js | 2 + .../preview/marketplace/availableAddOn.js | 2 + .../availableAddOn/availableAddOnExtension.js | 2 + .../preview/marketplace/installedAddOn.js | 2 + .../installedAddOn/installedAddOnExtension.js | 2 + lib/rest/preview/sync/service.js | 2 + lib/rest/preview/sync/service/document.js | 2 + .../service/document/documentPermission.js | 2 + lib/rest/preview/sync/service/syncList.js | 2 + .../sync/service/syncList/syncListItem.js | 2 + .../service/syncList/syncListPermission.js | 2 + lib/rest/preview/sync/service/syncMap.js | 2 + .../sync/service/syncMap/syncMapItem.js | 2 + .../sync/service/syncMap/syncMapPermission.js | 2 + lib/rest/preview/understand/assistant.js | 2 + .../preview/understand/assistant/fieldType.js | 2 + .../assistant/fieldType/fieldValue.js | 2 + .../understand/assistant/modelBuild.js | 2 + .../preview/understand/assistant/query.js | 2 + lib/rest/preview/understand/assistant/task.js | 2 + .../understand/assistant/task/field.js | 2 + .../understand/assistant/task/sample.js | 2 + lib/rest/preview/wireless/command.js | 2 + lib/rest/preview/wireless/ratePlan.js | 2 + lib/rest/preview/wireless/sim.js | 2 + lib/rest/pricing/v1/messaging/country.js | 2 + lib/rest/pricing/v1/phoneNumber/country.js | 2 + lib/rest/pricing/v1/voice/country.js | 2 + lib/rest/pricing/v2/country.js | 2 + lib/rest/pricing/v2/voice/country.js | 2 + lib/rest/proxy/v1/service.js | 2 + lib/rest/proxy/v1/service/phoneNumber.js | 2 + lib/rest/proxy/v1/service/session.js | 2 + .../proxy/v1/service/session/interaction.js | 2 + .../proxy/v1/service/session/participant.js | 2 + .../session/participant/messageInteraction.js | 2 + lib/rest/proxy/v1/service/shortCode.js | 2 + lib/rest/serverless/v1/service.js | 2 + lib/rest/serverless/v1/service/asset.js | 2 + .../v1/service/asset/assetVersion.js | 2 + lib/rest/serverless/v1/service/build.js | 2 + lib/rest/serverless/v1/service/environment.js | 2 + .../v1/service/environment/deployment.js | 2 + .../serverless/v1/service/environment/log.js | 2 + .../v1/service/environment/variable.js | 2 + lib/rest/serverless/v1/service/function.js | 2 + .../v1/service/function/functionVersion.js | 2 + lib/rest/studio/v1/flow.js | 2 + lib/rest/studio/v1/flow/engagement.js | 2 + lib/rest/studio/v1/flow/engagement/step.js | 2 + lib/rest/studio/v1/flow/execution.js | 2 + .../studio/v1/flow/execution/executionStep.js | 2 + lib/rest/studio/v2/flow.js | 2 + lib/rest/studio/v2/flow/execution.js | 2 + .../studio/v2/flow/execution/executionStep.js | 2 + lib/rest/studio/v2/flow/flowRevision.js | 2 + lib/rest/supersim/v1/command.js | 2 + lib/rest/supersim/v1/fleet.js | 2 + lib/rest/supersim/v1/ipCommand.js | 2 + lib/rest/supersim/v1/network.js | 2 + lib/rest/supersim/v1/networkAccessProfile.js | 2 + .../networkAccessProfileNetwork.js | 2 + lib/rest/supersim/v1/sim.js | 2 + lib/rest/supersim/v1/sim/billingPeriod.js | 2 + lib/rest/supersim/v1/smsCommand.js | 2 + lib/rest/supersim/v1/usageRecord.js | 2 + lib/rest/sync/v1/service.js | 2 + lib/rest/sync/v1/service/document.js | 2 + .../v1/service/document/documentPermission.js | 2 + lib/rest/sync/v1/service/syncList.js | 2 + .../sync/v1/service/syncList/syncListItem.js | 2 + .../v1/service/syncList/syncListPermission.js | 2 + lib/rest/sync/v1/service/syncMap.js | 2 + .../sync/v1/service/syncMap/syncMapItem.js | 2 + .../v1/service/syncMap/syncMapPermission.js | 2 + lib/rest/sync/v1/service/syncStream.js | 2 + lib/rest/taskrouter/v1/workspace.js | 2 + lib/rest/taskrouter/v1/workspace/activity.js | 2 + lib/rest/taskrouter/v1/workspace/event.js | 2 + lib/rest/taskrouter/v1/workspace/task.js | 2 + .../v1/workspace/task/reservation.js | 2 + .../taskrouter/v1/workspace/taskChannel.js | 2 + lib/rest/taskrouter/v1/workspace/taskQueue.js | 2 + .../taskQueue/taskQueuesStatistics.js | 2 + lib/rest/taskrouter/v1/workspace/worker.js | 2 + .../v1/workspace/worker/reservation.js | 2 + .../v1/workspace/worker/workerChannel.js | 2 + lib/rest/taskrouter/v1/workspace/workflow.js | 2 + lib/rest/trunking/v1/trunk.js | 2 + lib/rest/trunking/v1/trunk/credentialList.js | 2 + .../trunking/v1/trunk/ipAccessControlList.js | 2 + lib/rest/trunking/v1/trunk/originationUrl.js | 2 + lib/rest/trunking/v1/trunk/phoneNumber.js | 2 + lib/rest/trusthub/v1/customerProfiles.js | 2 + ...stomerProfilesChannelEndpointAssignment.js | 2 + .../customerProfilesEntityAssignments.js | 2 + .../customerProfilesEvaluations.js | 2 + lib/rest/trusthub/v1/endUser.js | 2 + lib/rest/trusthub/v1/endUserType.js | 2 + lib/rest/trusthub/v1/policies.js | 2 + lib/rest/trusthub/v1/supportingDocument.js | 2 + .../trusthub/v1/supportingDocumentType.js | 2 + lib/rest/trusthub/v1/trustProducts.js | 2 + .../trustProductsChannelEndpointAssignment.js | 2 + .../trustProductsEntityAssignments.js | 2 + .../trustProducts/trustProductsEvaluations.js | 2 + lib/rest/verify/v2/service.js | 2 + lib/rest/verify/v2/service/entity.js | 2 + .../verify/v2/service/entity/challenge.js | 2 + lib/rest/verify/v2/service/entity/factor.js | 2 + .../v2/service/messagingConfiguration.js | 2 + lib/rest/verify/v2/service/rateLimit.js | 2 + .../verify/v2/service/rateLimit/bucket.js | 2 + lib/rest/verify/v2/service/webhook.js | 2 + lib/rest/verify/v2/template.js | 2 + lib/rest/verify/v2/verificationAttempt.js | 2 + lib/rest/video/v1/composition.js | 2 + lib/rest/video/v1/compositionHook.js | 2 + lib/rest/video/v1/recording.js | 2 + lib/rest/video/v1/room.js | 2 + lib/rest/video/v1/room/recording.js | 2 + lib/rest/video/v1/room/roomParticipant.js | 2 + .../roomParticipantPublishedTrack.js | 2 + .../roomParticipantSubscribedTrack.js | 2 + lib/rest/voice/v1/byocTrunk.js | 2 + lib/rest/voice/v1/connectionPolicy.js | 2 + .../connectionPolicyTarget.js | 2 + .../voice/v1/dialingPermissions/country.js | 2 + .../country/highriskSpecialPrefix.js | 2 + lib/rest/voice/v1/ipRecord.js | 2 + lib/rest/voice/v1/sourceIpMapping.js | 2 + lib/rest/wireless/v1/command.js | 2 + lib/rest/wireless/v1/ratePlan.js | 2 + lib/rest/wireless/v1/sim.js | 2 + lib/rest/wireless/v1/sim/dataSession.js | 2 + lib/rest/wireless/v1/sim/usageRecord.js | 2 + lib/rest/wireless/v1/usageRecord.js | 2 + spec/unit/rest/incomingPhoneNumber.spec.js | 56 +++++++++++++++++++ 321 files changed, 696 insertions(+) create mode 100644 spec/unit/rest/incomingPhoneNumber.spec.js diff --git a/lib/rest/accounts/v1/credential/aws.js b/lib/rest/accounts/v1/credential/aws.js index a9316e3c92..219b7427cd 100644 --- a/lib/rest/accounts/v1/credential/aws.js +++ b/lib/rest/accounts/v1/credential/aws.js @@ -134,6 +134,8 @@ AwsList = function AwsList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/accounts/v1/credential/publicKey.js b/lib/rest/accounts/v1/credential/publicKey.js index 93ee61ff85..b734333a81 100644 --- a/lib/rest/accounts/v1/credential/publicKey.js +++ b/lib/rest/accounts/v1/credential/publicKey.js @@ -134,6 +134,8 @@ PublicKeyList = function PublicKeyList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account.js b/lib/rest/api/v2010/account.js index f2c61846f1..1d40f50617 100644 --- a/lib/rest/api/v2010/account.js +++ b/lib/rest/api/v2010/account.js @@ -207,6 +207,8 @@ AccountList = function AccountList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/address.js b/lib/rest/api/v2010/account/address.js index 0e659f6cdf..24efa91e7b 100644 --- a/lib/rest/api/v2010/account/address.js +++ b/lib/rest/api/v2010/account/address.js @@ -227,6 +227,8 @@ AddressList = function AddressList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/address/dependentPhoneNumber.js b/lib/rest/api/v2010/account/address/dependentPhoneNumber.js index 1e8aaff4dd..baa5a935a4 100644 --- a/lib/rest/api/v2010/account/address/dependentPhoneNumber.js +++ b/lib/rest/api/v2010/account/address/dependentPhoneNumber.js @@ -136,6 +136,8 @@ DependentPhoneNumberList = function DependentPhoneNumberList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/application.js b/lib/rest/api/v2010/account/application.js index 6e5c91541c..e8ac46dedd 100644 --- a/lib/rest/api/v2010/account/application.js +++ b/lib/rest/api/v2010/account/application.js @@ -226,6 +226,8 @@ ApplicationList = function ApplicationList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/authorizedConnectApp.js b/lib/rest/api/v2010/account/authorizedConnectApp.js index 28aa4a4775..b5e323c642 100644 --- a/lib/rest/api/v2010/account/authorizedConnectApp.js +++ b/lib/rest/api/v2010/account/authorizedConnectApp.js @@ -136,6 +136,8 @@ AuthorizedConnectAppList = function AuthorizedConnectAppList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber.js b/lib/rest/api/v2010/account/availablePhoneNumber.js index a004779b52..b9f398efa9 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber.js @@ -144,6 +144,8 @@ AvailablePhoneNumberCountryList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/local.js b/lib/rest/api/v2010/account/availablePhoneNumber/local.js index ecf5a9d728..5ae83ea559 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/local.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/local.js @@ -169,6 +169,8 @@ LocalList = function LocalList(version, accountSid, countryCode) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/machineToMachine.js b/lib/rest/api/v2010/account/availablePhoneNumber/machineToMachine.js index 85554c986f..c3e3d210e5 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/machineToMachine.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/machineToMachine.js @@ -170,6 +170,8 @@ MachineToMachineList = function MachineToMachineList(version, accountSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/mobile.js b/lib/rest/api/v2010/account/availablePhoneNumber/mobile.js index 726e0e00bb..1bd89bb39d 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/mobile.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/mobile.js @@ -169,6 +169,8 @@ MobileList = function MobileList(version, accountSid, countryCode) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/national.js b/lib/rest/api/v2010/account/availablePhoneNumber/national.js index 59e38f7710..ed49204bf0 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/national.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/national.js @@ -169,6 +169,8 @@ NationalList = function NationalList(version, accountSid, countryCode) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/sharedCost.js b/lib/rest/api/v2010/account/availablePhoneNumber/sharedCost.js index 363b61b1df..5827687d32 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/sharedCost.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/sharedCost.js @@ -169,6 +169,8 @@ SharedCostList = function SharedCostList(version, accountSid, countryCode) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/tollFree.js b/lib/rest/api/v2010/account/availablePhoneNumber/tollFree.js index afbd19319d..533d4f3c23 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/tollFree.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/tollFree.js @@ -169,6 +169,8 @@ TollFreeList = function TollFreeList(version, accountSid, countryCode) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/availablePhoneNumber/voip.js b/lib/rest/api/v2010/account/availablePhoneNumber/voip.js index ac545c96f3..749b294d6c 100644 --- a/lib/rest/api/v2010/account/availablePhoneNumber/voip.js +++ b/lib/rest/api/v2010/account/availablePhoneNumber/voip.js @@ -169,6 +169,8 @@ VoipList = function VoipList(version, accountSid, countryCode) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/call.js b/lib/rest/api/v2010/account/call.js index 0ddbc1e5a0..2ca4b04b2e 100644 --- a/lib/rest/api/v2010/account/call.js +++ b/lib/rest/api/v2010/account/call.js @@ -303,6 +303,8 @@ CallList = function CallList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/call/event.js b/lib/rest/api/v2010/account/call/event.js index 89a5bd49c9..9a8f831be7 100644 --- a/lib/rest/api/v2010/account/call/event.js +++ b/lib/rest/api/v2010/account/call/event.js @@ -133,6 +133,8 @@ EventList = function EventList(version, accountSid, callSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/call/notification.js b/lib/rest/api/v2010/account/call/notification.js index e63ffbeeef..ec620d0bad 100644 --- a/lib/rest/api/v2010/account/call/notification.js +++ b/lib/rest/api/v2010/account/call/notification.js @@ -142,6 +142,8 @@ NotificationList = function NotificationList(version, accountSid, callSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/call/recording.js b/lib/rest/api/v2010/account/call/recording.js index 414f74b827..e99989cb33 100644 --- a/lib/rest/api/v2010/account/call/recording.js +++ b/lib/rest/api/v2010/account/call/recording.js @@ -207,6 +207,8 @@ RecordingList = function RecordingList(version, accountSid, callSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/conference.js b/lib/rest/api/v2010/account/conference.js index 48b5f94e7b..46fee8743f 100644 --- a/lib/rest/api/v2010/account/conference.js +++ b/lib/rest/api/v2010/account/conference.js @@ -153,6 +153,8 @@ ConferenceList = function ConferenceList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/conference/participant.js b/lib/rest/api/v2010/account/conference/participant.js index 0a72edd0fe..b9376a08d9 100644 --- a/lib/rest/api/v2010/account/conference/participant.js +++ b/lib/rest/api/v2010/account/conference/participant.js @@ -303,6 +303,8 @@ ParticipantList = function ParticipantList(version, accountSid, conferenceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/conference/recording.js b/lib/rest/api/v2010/account/conference/recording.js index 6e21bb219f..51482905d8 100644 --- a/lib/rest/api/v2010/account/conference/recording.js +++ b/lib/rest/api/v2010/account/conference/recording.js @@ -145,6 +145,8 @@ RecordingList = function RecordingList(version, accountSid, conferenceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/connectApp.js b/lib/rest/api/v2010/account/connectApp.js index 2ec10a4fdc..81fa14be4c 100644 --- a/lib/rest/api/v2010/account/connectApp.js +++ b/lib/rest/api/v2010/account/connectApp.js @@ -134,6 +134,8 @@ ConnectAppList = function ConnectAppList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/incomingPhoneNumber.js b/lib/rest/api/v2010/account/incomingPhoneNumber.js index a3d663b381..fcbca046bc 100644 --- a/lib/rest/api/v2010/account/incomingPhoneNumber.js +++ b/lib/rest/api/v2010/account/incomingPhoneNumber.js @@ -155,6 +155,8 @@ IncomingPhoneNumberList = function IncomingPhoneNumberList(version, accountSid) if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.js b/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.js index be9ddf3783..137c0d1fc2 100644 --- a/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.js +++ b/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.js @@ -143,6 +143,8 @@ AssignedAddOnList = function AssignedAddOnList(version, accountSid, resourceSid) if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.js b/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.js index 8807680072..06de6da2ae 100644 --- a/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.js +++ b/lib/rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.js @@ -145,6 +145,8 @@ AssignedAddOnExtensionList = function AssignedAddOnExtensionList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/incomingPhoneNumber/local.js b/lib/rest/api/v2010/account/incomingPhoneNumber/local.js index 560bdfc405..faa5fd2f61 100644 --- a/lib/rest/api/v2010/account/incomingPhoneNumber/local.js +++ b/lib/rest/api/v2010/account/incomingPhoneNumber/local.js @@ -142,6 +142,8 @@ LocalList = function LocalList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/incomingPhoneNumber/mobile.js b/lib/rest/api/v2010/account/incomingPhoneNumber/mobile.js index fa375d590d..1b57e0e4b2 100644 --- a/lib/rest/api/v2010/account/incomingPhoneNumber/mobile.js +++ b/lib/rest/api/v2010/account/incomingPhoneNumber/mobile.js @@ -142,6 +142,8 @@ MobileList = function MobileList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/incomingPhoneNumber/tollFree.js b/lib/rest/api/v2010/account/incomingPhoneNumber/tollFree.js index cbe2b1a0ac..494217089b 100644 --- a/lib/rest/api/v2010/account/incomingPhoneNumber/tollFree.js +++ b/lib/rest/api/v2010/account/incomingPhoneNumber/tollFree.js @@ -142,6 +142,8 @@ TollFreeList = function TollFreeList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/key.js b/lib/rest/api/v2010/account/key.js index 58168ae6bf..6f99ca987b 100644 --- a/lib/rest/api/v2010/account/key.js +++ b/lib/rest/api/v2010/account/key.js @@ -136,6 +136,8 @@ KeyList = function KeyList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/message.js b/lib/rest/api/v2010/account/message.js index c4633f2d5b..f793f9d31f 100644 --- a/lib/rest/api/v2010/account/message.js +++ b/lib/rest/api/v2010/account/message.js @@ -237,6 +237,8 @@ MessageList = function MessageList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/message/media.js b/lib/rest/api/v2010/account/message/media.js index 734dc800d1..4bd9986e3d 100644 --- a/lib/rest/api/v2010/account/message/media.js +++ b/lib/rest/api/v2010/account/message/media.js @@ -144,6 +144,8 @@ MediaList = function MediaList(version, accountSid, messageSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/notification.js b/lib/rest/api/v2010/account/notification.js index ffd865887a..9e0090dad2 100644 --- a/lib/rest/api/v2010/account/notification.js +++ b/lib/rest/api/v2010/account/notification.js @@ -140,6 +140,8 @@ NotificationList = function NotificationList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/outgoingCallerId.js b/lib/rest/api/v2010/account/outgoingCallerId.js index e08e255c56..7b41335c98 100644 --- a/lib/rest/api/v2010/account/outgoingCallerId.js +++ b/lib/rest/api/v2010/account/outgoingCallerId.js @@ -139,6 +139,8 @@ OutgoingCallerIdList = function OutgoingCallerIdList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/queue.js b/lib/rest/api/v2010/account/queue.js index fbf9432a4a..f971b8eb43 100644 --- a/lib/rest/api/v2010/account/queue.js +++ b/lib/rest/api/v2010/account/queue.js @@ -136,6 +136,8 @@ QueueList = function QueueList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/queue/member.js b/lib/rest/api/v2010/account/queue/member.js index 70fb4cd851..6bb4573947 100644 --- a/lib/rest/api/v2010/account/queue/member.js +++ b/lib/rest/api/v2010/account/queue/member.js @@ -136,6 +136,8 @@ MemberList = function MemberList(version, accountSid, queueSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/recording.js b/lib/rest/api/v2010/account/recording.js index 184b82ff60..c18b16012f 100644 --- a/lib/rest/api/v2010/account/recording.js +++ b/lib/rest/api/v2010/account/recording.js @@ -147,6 +147,8 @@ RecordingList = function RecordingList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/recording/addOnResult.js b/lib/rest/api/v2010/account/recording/addOnResult.js index 1106fdcf51..03c4b4bf8d 100644 --- a/lib/rest/api/v2010/account/recording/addOnResult.js +++ b/lib/rest/api/v2010/account/recording/addOnResult.js @@ -138,6 +138,8 @@ AddOnResultList = function AddOnResultList(version, accountSid, referenceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/recording/addOnResult/payload.js b/lib/rest/api/v2010/account/recording/addOnResult/payload.js index e174388d07..7f5a8fc768 100644 --- a/lib/rest/api/v2010/account/recording/addOnResult/payload.js +++ b/lib/rest/api/v2010/account/recording/addOnResult/payload.js @@ -144,6 +144,8 @@ PayloadList = function PayloadList(version, accountSid, referenceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/recording/transcription.js b/lib/rest/api/v2010/account/recording/transcription.js index 14ea20ab87..d31c9dccde 100644 --- a/lib/rest/api/v2010/account/recording/transcription.js +++ b/lib/rest/api/v2010/account/recording/transcription.js @@ -138,6 +138,8 @@ TranscriptionList = function TranscriptionList(version, accountSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/shortCode.js b/lib/rest/api/v2010/account/shortCode.js index 287e195e5b..09eb354f4f 100644 --- a/lib/rest/api/v2010/account/shortCode.js +++ b/lib/rest/api/v2010/account/shortCode.js @@ -138,6 +138,8 @@ ShortCodeList = function ShortCodeList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/signingKey.js b/lib/rest/api/v2010/account/signingKey.js index d8d89aa035..ca57cfbe21 100644 --- a/lib/rest/api/v2010/account/signingKey.js +++ b/lib/rest/api/v2010/account/signingKey.js @@ -136,6 +136,8 @@ SigningKeyList = function SigningKeyList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/credentialList.js b/lib/rest/api/v2010/account/sip/credentialList.js index d453d8acba..1677ff879d 100644 --- a/lib/rest/api/v2010/account/sip/credentialList.js +++ b/lib/rest/api/v2010/account/sip/credentialList.js @@ -137,6 +137,8 @@ CredentialListList = function CredentialListList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/credentialList/credential.js b/lib/rest/api/v2010/account/sip/credentialList/credential.js index 752f28e69a..599b46fca7 100644 --- a/lib/rest/api/v2010/account/sip/credentialList/credential.js +++ b/lib/rest/api/v2010/account/sip/credentialList/credential.js @@ -139,6 +139,8 @@ CredentialList = function CredentialList(version, accountSid, credentialListSid) if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/domain.js b/lib/rest/api/v2010/account/sip/domain.js index f4d8af4235..35a0a1a505 100644 --- a/lib/rest/api/v2010/account/sip/domain.js +++ b/lib/rest/api/v2010/account/sip/domain.js @@ -143,6 +143,8 @@ DomainList = function DomainList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsCredentialListMapping.js b/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsCredentialListMapping.js index 4f4d8e80ef..bfd0cdb7eb 100644 --- a/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsCredentialListMapping.js +++ b/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsCredentialListMapping.js @@ -193,6 +193,8 @@ AuthCallsCredentialListMappingList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsIpAccessControlListMapping.js b/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsIpAccessControlListMapping.js index db1477046e..c05f5a67c2 100644 --- a/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsIpAccessControlListMapping.js +++ b/lib/rest/api/v2010/account/sip/domain/authTypes/authCallsMapping/authCallsIpAccessControlListMapping.js @@ -193,6 +193,8 @@ AuthCallsIpAccessControlListMappingList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/domain/authTypes/authRegistrationsMapping/authRegistrationsCredentialListMapping.js b/lib/rest/api/v2010/account/sip/domain/authTypes/authRegistrationsMapping/authRegistrationsCredentialListMapping.js index d5802ddc26..608b00eb74 100644 --- a/lib/rest/api/v2010/account/sip/domain/authTypes/authRegistrationsMapping/authRegistrationsCredentialListMapping.js +++ b/lib/rest/api/v2010/account/sip/domain/authTypes/authRegistrationsMapping/authRegistrationsCredentialListMapping.js @@ -193,6 +193,8 @@ AuthRegistrationsCredentialListMappingList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/domain/credentialListMapping.js b/lib/rest/api/v2010/account/sip/domain/credentialListMapping.js index 16377fb13d..c4efe5d46e 100644 --- a/lib/rest/api/v2010/account/sip/domain/credentialListMapping.js +++ b/lib/rest/api/v2010/account/sip/domain/credentialListMapping.js @@ -188,6 +188,8 @@ CredentialListMappingList = function CredentialListMappingList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.js b/lib/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.js index 63073174c9..70f6259d4d 100644 --- a/lib/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.js +++ b/lib/rest/api/v2010/account/sip/domain/ipAccessControlListMapping.js @@ -189,6 +189,8 @@ IpAccessControlListMappingList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/ipAccessControlList.js b/lib/rest/api/v2010/account/sip/ipAccessControlList.js index 69372761fb..1a6dee0c1c 100644 --- a/lib/rest/api/v2010/account/sip/ipAccessControlList.js +++ b/lib/rest/api/v2010/account/sip/ipAccessControlList.js @@ -138,6 +138,8 @@ IpAccessControlListList = function IpAccessControlListList(version, accountSid) if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js b/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js index 8d76f70ccc..d54a44084e 100644 --- a/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js +++ b/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js @@ -142,6 +142,8 @@ IpAddressList = function IpAddressList(version, accountSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/transcription.js b/lib/rest/api/v2010/account/transcription.js index dcd12d54fa..11c548425e 100644 --- a/lib/rest/api/v2010/account/transcription.js +++ b/lib/rest/api/v2010/account/transcription.js @@ -135,6 +135,8 @@ TranscriptionList = function TranscriptionList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record.js b/lib/rest/api/v2010/account/usage/record.js index c49900f87e..896cbcd754 100644 --- a/lib/rest/api/v2010/account/usage/record.js +++ b/lib/rest/api/v2010/account/usage/record.js @@ -164,6 +164,8 @@ RecordList = function RecordList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/allTime.js b/lib/rest/api/v2010/account/usage/record/allTime.js index 97f292eac0..c14cf4a309 100644 --- a/lib/rest/api/v2010/account/usage/record/allTime.js +++ b/lib/rest/api/v2010/account/usage/record/allTime.js @@ -145,6 +145,8 @@ AllTimeList = function AllTimeList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/daily.js b/lib/rest/api/v2010/account/usage/record/daily.js index de5a936380..41a4d68663 100644 --- a/lib/rest/api/v2010/account/usage/record/daily.js +++ b/lib/rest/api/v2010/account/usage/record/daily.js @@ -145,6 +145,8 @@ DailyList = function DailyList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/lastMonth.js b/lib/rest/api/v2010/account/usage/record/lastMonth.js index e20375f5d2..a399a42121 100644 --- a/lib/rest/api/v2010/account/usage/record/lastMonth.js +++ b/lib/rest/api/v2010/account/usage/record/lastMonth.js @@ -145,6 +145,8 @@ LastMonthList = function LastMonthList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/monthly.js b/lib/rest/api/v2010/account/usage/record/monthly.js index 59cc123fe4..8d539d8c70 100644 --- a/lib/rest/api/v2010/account/usage/record/monthly.js +++ b/lib/rest/api/v2010/account/usage/record/monthly.js @@ -145,6 +145,8 @@ MonthlyList = function MonthlyList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/thisMonth.js b/lib/rest/api/v2010/account/usage/record/thisMonth.js index 4bedce1313..de7b545021 100644 --- a/lib/rest/api/v2010/account/usage/record/thisMonth.js +++ b/lib/rest/api/v2010/account/usage/record/thisMonth.js @@ -145,6 +145,8 @@ ThisMonthList = function ThisMonthList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/today.js b/lib/rest/api/v2010/account/usage/record/today.js index 1b7ed6dcff..a31e92ca1c 100644 --- a/lib/rest/api/v2010/account/usage/record/today.js +++ b/lib/rest/api/v2010/account/usage/record/today.js @@ -145,6 +145,8 @@ TodayList = function TodayList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/yearly.js b/lib/rest/api/v2010/account/usage/record/yearly.js index 4d2ae5fb6f..a5114c63a1 100644 --- a/lib/rest/api/v2010/account/usage/record/yearly.js +++ b/lib/rest/api/v2010/account/usage/record/yearly.js @@ -145,6 +145,8 @@ YearlyList = function YearlyList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/record/yesterday.js b/lib/rest/api/v2010/account/usage/record/yesterday.js index 56956e685a..1fef5d605a 100644 --- a/lib/rest/api/v2010/account/usage/record/yesterday.js +++ b/lib/rest/api/v2010/account/usage/record/yesterday.js @@ -145,6 +145,8 @@ YesterdayList = function YesterdayList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/api/v2010/account/usage/trigger.js b/lib/rest/api/v2010/account/usage/trigger.js index 64f0835c62..f11bf4c9dd 100644 --- a/lib/rest/api/v2010/account/usage/trigger.js +++ b/lib/rest/api/v2010/account/usage/trigger.js @@ -214,6 +214,8 @@ TriggerList = function TriggerList(version, accountSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant.js b/lib/rest/autopilot/v1/assistant.js index 682a5b1592..9f5933b868 100644 --- a/lib/rest/autopilot/v1/assistant.js +++ b/lib/rest/autopilot/v1/assistant.js @@ -147,6 +147,8 @@ AssistantList = function AssistantList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/fieldType.js b/lib/rest/autopilot/v1/assistant/fieldType.js index 5f2c8b4353..7fc193c870 100644 --- a/lib/rest/autopilot/v1/assistant/fieldType.js +++ b/lib/rest/autopilot/v1/assistant/fieldType.js @@ -141,6 +141,8 @@ FieldTypeList = function FieldTypeList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/fieldType/fieldValue.js b/lib/rest/autopilot/v1/assistant/fieldType/fieldValue.js index af80d705a5..f2b6425303 100644 --- a/lib/rest/autopilot/v1/assistant/fieldType/fieldValue.js +++ b/lib/rest/autopilot/v1/assistant/fieldType/fieldValue.js @@ -144,6 +144,8 @@ FieldValueList = function FieldValueList(version, assistantSid, fieldTypeSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/modelBuild.js b/lib/rest/autopilot/v1/assistant/modelBuild.js index 4a29dabd39..c77546448a 100644 --- a/lib/rest/autopilot/v1/assistant/modelBuild.js +++ b/lib/rest/autopilot/v1/assistant/modelBuild.js @@ -140,6 +140,8 @@ ModelBuildList = function ModelBuildList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/query.js b/lib/rest/autopilot/v1/assistant/query.js index 08f0ba8a48..c9af92e20a 100644 --- a/lib/rest/autopilot/v1/assistant/query.js +++ b/lib/rest/autopilot/v1/assistant/query.js @@ -147,6 +147,8 @@ QueryList = function QueryList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/task.js b/lib/rest/autopilot/v1/assistant/task.js index 48db90566f..12d4eb4b3f 100644 --- a/lib/rest/autopilot/v1/assistant/task.js +++ b/lib/rest/autopilot/v1/assistant/task.js @@ -145,6 +145,8 @@ TaskList = function TaskList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/task/field.js b/lib/rest/autopilot/v1/assistant/task/field.js index a949bc2634..df8951816b 100644 --- a/lib/rest/autopilot/v1/assistant/task/field.js +++ b/lib/rest/autopilot/v1/assistant/task/field.js @@ -142,6 +142,8 @@ FieldList = function FieldList(version, assistantSid, taskSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/task/sample.js b/lib/rest/autopilot/v1/assistant/task/sample.js index dcb866644c..a896a234c0 100644 --- a/lib/rest/autopilot/v1/assistant/task/sample.js +++ b/lib/rest/autopilot/v1/assistant/task/sample.js @@ -143,6 +143,8 @@ SampleList = function SampleList(version, assistantSid, taskSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/autopilot/v1/assistant/webhook.js b/lib/rest/autopilot/v1/assistant/webhook.js index 835dcee963..f7d0cfebf1 100644 --- a/lib/rest/autopilot/v1/assistant/webhook.js +++ b/lib/rest/autopilot/v1/assistant/webhook.js @@ -140,6 +140,8 @@ WebhookList = function WebhookList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/bulkexports/v1/export/day.js b/lib/rest/bulkexports/v1/export/day.js index 4c5355fdbd..0ebf577235 100644 --- a/lib/rest/bulkexports/v1/export/day.js +++ b/lib/rest/bulkexports/v1/export/day.js @@ -136,6 +136,8 @@ DayList = function DayList(version, resourceType) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/bulkexports/v1/export/exportCustomJob.js b/lib/rest/bulkexports/v1/export/exportCustomJob.js index df8ba309ed..3b5a4726d1 100644 --- a/lib/rest/bulkexports/v1/export/exportCustomJob.js +++ b/lib/rest/bulkexports/v1/export/exportCustomJob.js @@ -133,6 +133,8 @@ ExportCustomJobList = function ExportCustomJobList(version, resourceType) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/credential.js b/lib/rest/chat/v1/credential.js index 82992dc31a..a8ffac9661 100644 --- a/lib/rest/chat/v1/credential.js +++ b/lib/rest/chat/v1/credential.js @@ -135,6 +135,8 @@ CredentialList = function CredentialList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service.js b/lib/rest/chat/v1/service.js index f402d1421e..4c85d58215 100644 --- a/lib/rest/chat/v1/service.js +++ b/lib/rest/chat/v1/service.js @@ -180,6 +180,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/channel.js b/lib/rest/chat/v1/service/channel.js index 10188824ac..cc610a28e5 100644 --- a/lib/rest/chat/v1/service/channel.js +++ b/lib/rest/chat/v1/service/channel.js @@ -198,6 +198,8 @@ ChannelList = function ChannelList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/channel/invite.js b/lib/rest/chat/v1/service/channel/invite.js index ac59d2aab6..a57b5faf5f 100644 --- a/lib/rest/chat/v1/service/channel/invite.js +++ b/lib/rest/chat/v1/service/channel/invite.js @@ -191,6 +191,8 @@ InviteList = function InviteList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/channel/member.js b/lib/rest/chat/v1/service/channel/member.js index 2258735064..255393a228 100644 --- a/lib/rest/chat/v1/service/channel/member.js +++ b/lib/rest/chat/v1/service/channel/member.js @@ -191,6 +191,8 @@ MemberList = function MemberList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/channel/message.js b/lib/rest/chat/v1/service/channel/message.js index 7bf4c92d06..4a89a0a4c2 100644 --- a/lib/rest/chat/v1/service/channel/message.js +++ b/lib/rest/chat/v1/service/channel/message.js @@ -195,6 +195,8 @@ MessageList = function MessageList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/role.js b/lib/rest/chat/v1/service/role.js index 6f47f97c1e..baf5801981 100644 --- a/lib/rest/chat/v1/service/role.js +++ b/lib/rest/chat/v1/service/role.js @@ -196,6 +196,8 @@ RoleList = function RoleList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/user.js b/lib/rest/chat/v1/service/user.js index da4a68225c..2f92ca340c 100644 --- a/lib/rest/chat/v1/service/user.js +++ b/lib/rest/chat/v1/service/user.js @@ -194,6 +194,8 @@ UserList = function UserList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v1/service/user/userChannel.js b/lib/rest/chat/v1/service/user/userChannel.js index 4befad4ac5..4a9bd8fa0d 100644 --- a/lib/rest/chat/v1/service/user/userChannel.js +++ b/lib/rest/chat/v1/service/user/userChannel.js @@ -136,6 +136,8 @@ UserChannelList = function UserChannelList(version, serviceSid, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/credential.js b/lib/rest/chat/v2/credential.js index eaa8828ab2..0ec102f9fe 100644 --- a/lib/rest/chat/v2/credential.js +++ b/lib/rest/chat/v2/credential.js @@ -135,6 +135,8 @@ CredentialList = function CredentialList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service.js b/lib/rest/chat/v2/service.js index f92d2bc28a..5bd17d2b28 100644 --- a/lib/rest/chat/v2/service.js +++ b/lib/rest/chat/v2/service.js @@ -181,6 +181,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/binding.js b/lib/rest/chat/v2/service/binding.js index 4421c384f9..71251fda69 100644 --- a/lib/rest/chat/v2/service/binding.js +++ b/lib/rest/chat/v2/service/binding.js @@ -141,6 +141,8 @@ BindingList = function BindingList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/channel.js b/lib/rest/chat/v2/service/channel.js index 160ed9497f..9f09683075 100644 --- a/lib/rest/chat/v2/service/channel.js +++ b/lib/rest/chat/v2/service/channel.js @@ -211,6 +211,8 @@ ChannelList = function ChannelList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/channel/invite.js b/lib/rest/chat/v2/service/channel/invite.js index 2bc7e4bd50..d6de689730 100644 --- a/lib/rest/chat/v2/service/channel/invite.js +++ b/lib/rest/chat/v2/service/channel/invite.js @@ -191,6 +191,8 @@ InviteList = function InviteList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/channel/member.js b/lib/rest/chat/v2/service/channel/member.js index f86f2f556b..dcc0e56fe9 100644 --- a/lib/rest/chat/v2/service/channel/member.js +++ b/lib/rest/chat/v2/service/channel/member.js @@ -212,6 +212,8 @@ MemberList = function MemberList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/channel/message.js b/lib/rest/chat/v2/service/channel/message.js index eae6ee69bb..53ce76efdb 100644 --- a/lib/rest/chat/v2/service/channel/message.js +++ b/lib/rest/chat/v2/service/channel/message.js @@ -211,6 +211,8 @@ MessageList = function MessageList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/channel/webhook.js b/lib/rest/chat/v2/service/channel/webhook.js index a881c2f05a..c35a5ec3b6 100644 --- a/lib/rest/chat/v2/service/channel/webhook.js +++ b/lib/rest/chat/v2/service/channel/webhook.js @@ -140,6 +140,8 @@ WebhookList = function WebhookList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/role.js b/lib/rest/chat/v2/service/role.js index 983cba3e08..047f996c7d 100644 --- a/lib/rest/chat/v2/service/role.js +++ b/lib/rest/chat/v2/service/role.js @@ -196,6 +196,8 @@ RoleList = function RoleList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/user.js b/lib/rest/chat/v2/service/user.js index 419fb97860..94cccd7128 100644 --- a/lib/rest/chat/v2/service/user.js +++ b/lib/rest/chat/v2/service/user.js @@ -198,6 +198,8 @@ UserList = function UserList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/user/userBinding.js b/lib/rest/chat/v2/service/user/userBinding.js index 17b71ea8d2..0257de7fbf 100644 --- a/lib/rest/chat/v2/service/user/userBinding.js +++ b/lib/rest/chat/v2/service/user/userBinding.js @@ -141,6 +141,8 @@ UserBindingList = function UserBindingList(version, serviceSid, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/chat/v2/service/user/userChannel.js b/lib/rest/chat/v2/service/user/userChannel.js index 3aa036fa41..30de621c4b 100644 --- a/lib/rest/chat/v2/service/user/userChannel.js +++ b/lib/rest/chat/v2/service/user/userChannel.js @@ -139,6 +139,8 @@ UserChannelList = function UserChannelList(version, serviceSid, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/conversation.js b/lib/rest/conversations/v1/conversation.js index c71f5d71dd..503c49679e 100644 --- a/lib/rest/conversations/v1/conversation.js +++ b/lib/rest/conversations/v1/conversation.js @@ -206,6 +206,8 @@ ConversationList = function ConversationList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/conversation/message.js b/lib/rest/conversations/v1/conversation/message.js index 2de3ddb5ef..d2a382cd9c 100644 --- a/lib/rest/conversations/v1/conversation/message.js +++ b/lib/rest/conversations/v1/conversation/message.js @@ -205,6 +205,8 @@ MessageList = function MessageList(version, conversationSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/conversation/message/deliveryReceipt.js b/lib/rest/conversations/v1/conversation/message/deliveryReceipt.js index ec5c59f45b..c0234fd530 100644 --- a/lib/rest/conversations/v1/conversation/message/deliveryReceipt.js +++ b/lib/rest/conversations/v1/conversation/message/deliveryReceipt.js @@ -139,6 +139,8 @@ DeliveryReceiptList = function DeliveryReceiptList(version, conversationSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/conversation/participant.js b/lib/rest/conversations/v1/conversation/participant.js index f92dccd248..bfceb3d082 100644 --- a/lib/rest/conversations/v1/conversation/participant.js +++ b/lib/rest/conversations/v1/conversation/participant.js @@ -208,6 +208,8 @@ ParticipantList = function ParticipantList(version, conversationSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/conversation/webhook.js b/lib/rest/conversations/v1/conversation/webhook.js index a92abc042e..832d20fe00 100644 --- a/lib/rest/conversations/v1/conversation/webhook.js +++ b/lib/rest/conversations/v1/conversation/webhook.js @@ -137,6 +137,8 @@ WebhookList = function WebhookList(version, conversationSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/credential.js b/lib/rest/conversations/v1/credential.js index 8159a73ecd..81cc1423fe 100644 --- a/lib/rest/conversations/v1/credential.js +++ b/lib/rest/conversations/v1/credential.js @@ -197,6 +197,8 @@ CredentialList = function CredentialList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/participantConversation.js b/lib/rest/conversations/v1/participantConversation.js index 78cd8088bb..f0c6d8b6f7 100644 --- a/lib/rest/conversations/v1/participantConversation.js +++ b/lib/rest/conversations/v1/participantConversation.js @@ -137,6 +137,8 @@ ParticipantConversationList = function ParticipantConversationList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/role.js b/lib/rest/conversations/v1/role.js index 47d3063caf..ba77e6621e 100644 --- a/lib/rest/conversations/v1/role.js +++ b/lib/rest/conversations/v1/role.js @@ -189,6 +189,8 @@ RoleList = function RoleList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service.js b/lib/rest/conversations/v1/service.js index 05362793df..11e83cf9e3 100644 --- a/lib/rest/conversations/v1/service.js +++ b/lib/rest/conversations/v1/service.js @@ -183,6 +183,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/binding.js b/lib/rest/conversations/v1/service/binding.js index 366ee3b20a..b4ce9a6a2f 100644 --- a/lib/rest/conversations/v1/service/binding.js +++ b/lib/rest/conversations/v1/service/binding.js @@ -141,6 +141,8 @@ BindingList = function BindingList(version, chatServiceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/conversation.js b/lib/rest/conversations/v1/service/conversation.js index 41a97e7967..f41679ea9e 100644 --- a/lib/rest/conversations/v1/service/conversation.js +++ b/lib/rest/conversations/v1/service/conversation.js @@ -213,6 +213,8 @@ ConversationList = function ConversationList(version, chatServiceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/conversation/message.js b/lib/rest/conversations/v1/service/conversation/message.js index 5e0a954ae9..7b11744164 100644 --- a/lib/rest/conversations/v1/service/conversation/message.js +++ b/lib/rest/conversations/v1/service/conversation/message.js @@ -209,6 +209,8 @@ MessageList = function MessageList(version, chatServiceSid, conversationSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/conversation/message/deliveryReceipt.js b/lib/rest/conversations/v1/service/conversation/message/deliveryReceipt.js index 0a0575beab..a42f738b17 100644 --- a/lib/rest/conversations/v1/service/conversation/message/deliveryReceipt.js +++ b/lib/rest/conversations/v1/service/conversation/message/deliveryReceipt.js @@ -146,6 +146,8 @@ DeliveryReceiptList = function DeliveryReceiptList(version, chatServiceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/conversation/participant.js b/lib/rest/conversations/v1/service/conversation/participant.js index f9c7086e49..3bfeea3450 100644 --- a/lib/rest/conversations/v1/service/conversation/participant.js +++ b/lib/rest/conversations/v1/service/conversation/participant.js @@ -216,6 +216,8 @@ ParticipantList = function ParticipantList(version, chatServiceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/conversation/webhook.js b/lib/rest/conversations/v1/service/conversation/webhook.js index bdfab89d1d..3be65a5ce1 100644 --- a/lib/rest/conversations/v1/service/conversation/webhook.js +++ b/lib/rest/conversations/v1/service/conversation/webhook.js @@ -208,6 +208,8 @@ WebhookList = function WebhookList(version, chatServiceSid, conversationSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/participantConversation.js b/lib/rest/conversations/v1/service/participantConversation.js index ac461cdeaa..759817654d 100644 --- a/lib/rest/conversations/v1/service/participantConversation.js +++ b/lib/rest/conversations/v1/service/participantConversation.js @@ -140,6 +140,8 @@ ParticipantConversationList = function ParticipantConversationList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/role.js b/lib/rest/conversations/v1/service/role.js index 8c575b86cc..c4e8c944fd 100644 --- a/lib/rest/conversations/v1/service/role.js +++ b/lib/rest/conversations/v1/service/role.js @@ -196,6 +196,8 @@ RoleList = function RoleList(version, chatServiceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/user.js b/lib/rest/conversations/v1/service/user.js index a3bae9361e..4d8f47fc4c 100644 --- a/lib/rest/conversations/v1/service/user.js +++ b/lib/rest/conversations/v1/service/user.js @@ -199,6 +199,8 @@ UserList = function UserList(version, chatServiceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/service/user/userConversation.js b/lib/rest/conversations/v1/service/user/userConversation.js index 2fbda85970..66a2cb8ccb 100644 --- a/lib/rest/conversations/v1/service/user/userConversation.js +++ b/lib/rest/conversations/v1/service/user/userConversation.js @@ -140,6 +140,8 @@ UserConversationList = function UserConversationList(version, chatServiceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/user.js b/lib/rest/conversations/v1/user.js index 3862f8b28d..66de15f236 100644 --- a/lib/rest/conversations/v1/user.js +++ b/lib/rest/conversations/v1/user.js @@ -192,6 +192,8 @@ UserList = function UserList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/conversations/v1/user/userConversation.js b/lib/rest/conversations/v1/user/userConversation.js index dfc5132b71..a6bac05874 100644 --- a/lib/rest/conversations/v1/user/userConversation.js +++ b/lib/rest/conversations/v1/user/userConversation.js @@ -136,6 +136,8 @@ UserConversationList = function UserConversationList(version, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/events/v1/eventType.js b/lib/rest/events/v1/eventType.js index c41374b07b..02ce9a6f42 100644 --- a/lib/rest/events/v1/eventType.js +++ b/lib/rest/events/v1/eventType.js @@ -138,6 +138,8 @@ EventTypeList = function EventTypeList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/events/v1/schema/version.js b/lib/rest/events/v1/schema/version.js index 36b9e7cef0..edea1a8caa 100644 --- a/lib/rest/events/v1/schema/version.js +++ b/lib/rest/events/v1/schema/version.js @@ -138,6 +138,8 @@ SchemaVersionList = function SchemaVersionList(version, id) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/events/v1/sink.js b/lib/rest/events/v1/sink.js index ed705e6391..48cd9161b7 100644 --- a/lib/rest/events/v1/sink.js +++ b/lib/rest/events/v1/sink.js @@ -197,6 +197,8 @@ SinkList = function SinkList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/events/v1/subscription.js b/lib/rest/events/v1/subscription.js index 4d62593a21..489bbf47a6 100644 --- a/lib/rest/events/v1/subscription.js +++ b/lib/rest/events/v1/subscription.js @@ -141,6 +141,8 @@ SubscriptionList = function SubscriptionList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/events/v1/subscription/subscribedEvent.js b/lib/rest/events/v1/subscription/subscribedEvent.js index 48fdc209b5..5d5588f257 100644 --- a/lib/rest/events/v1/subscription/subscribedEvent.js +++ b/lib/rest/events/v1/subscription/subscribedEvent.js @@ -138,6 +138,8 @@ SubscribedEventList = function SubscribedEventList(version, subscriptionSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/fax/v1/fax.js b/lib/rest/fax/v1/fax.js index fd2b12566b..8c5b309d0e 100644 --- a/lib/rest/fax/v1/fax.js +++ b/lib/rest/fax/v1/fax.js @@ -146,6 +146,8 @@ FaxList = function FaxList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/fax/v1/fax/faxMedia.js b/lib/rest/fax/v1/fax/faxMedia.js index 3701039ba5..c8b0f74fd3 100644 --- a/lib/rest/fax/v1/fax/faxMedia.js +++ b/lib/rest/fax/v1/fax/faxMedia.js @@ -139,6 +139,8 @@ FaxMediaList = function FaxMediaList(version, faxSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/flexApi/v1/channel.js b/lib/rest/flexApi/v1/channel.js index 6d597729be..aeeb432a09 100644 --- a/lib/rest/flexApi/v1/channel.js +++ b/lib/rest/flexApi/v1/channel.js @@ -135,6 +135,8 @@ ChannelList = function ChannelList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/flexApi/v1/flexFlow.js b/lib/rest/flexApi/v1/flexFlow.js index 4fcd1aeb97..23dfbc7951 100644 --- a/lib/rest/flexApi/v1/flexFlow.js +++ b/lib/rest/flexApi/v1/flexFlow.js @@ -137,6 +137,8 @@ FlexFlowList = function FlexFlowList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/flexApi/v1/webChannel.js b/lib/rest/flexApi/v1/webChannel.js index 08d7bd054e..202d53ddbe 100644 --- a/lib/rest/flexApi/v1/webChannel.js +++ b/lib/rest/flexApi/v1/webChannel.js @@ -134,6 +134,8 @@ WebChannelList = function WebChannelList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/insights/v1/call/event.js b/lib/rest/insights/v1/call/event.js index 232a95fe92..fa34fc0629 100644 --- a/lib/rest/insights/v1/call/event.js +++ b/lib/rest/insights/v1/call/event.js @@ -137,6 +137,8 @@ EventList = function EventList(version, callSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/insights/v1/call/metric.js b/lib/rest/insights/v1/call/metric.js index 41731a5b1f..92f99995c9 100644 --- a/lib/rest/insights/v1/call/metric.js +++ b/lib/rest/insights/v1/call/metric.js @@ -138,6 +138,8 @@ MetricList = function MetricList(version, callSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/insights/v1/callSummaries.js b/lib/rest/insights/v1/callSummaries.js index 066b7e9453..ea2ed90dcc 100644 --- a/lib/rest/insights/v1/callSummaries.js +++ b/lib/rest/insights/v1/callSummaries.js @@ -153,6 +153,8 @@ CallSummariesList = function CallSummariesList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/insights/v1/room.js b/lib/rest/insights/v1/room.js index 24f33534f4..2000145777 100644 --- a/lib/rest/insights/v1/room.js +++ b/lib/rest/insights/v1/room.js @@ -146,6 +146,8 @@ RoomList = function RoomList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/insights/v1/room/participant.js b/lib/rest/insights/v1/room/participant.js index 8fe5f10547..8958fa898f 100644 --- a/lib/rest/insights/v1/room/participant.js +++ b/lib/rest/insights/v1/room/participant.js @@ -138,6 +138,8 @@ ParticipantList = function ParticipantList(version, roomSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/credential.js b/lib/rest/ipMessaging/v1/credential.js index 3be43ab453..318a3a5470 100644 --- a/lib/rest/ipMessaging/v1/credential.js +++ b/lib/rest/ipMessaging/v1/credential.js @@ -135,6 +135,8 @@ CredentialList = function CredentialList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service.js b/lib/rest/ipMessaging/v1/service.js index a655137e00..2fa11d7dc4 100644 --- a/lib/rest/ipMessaging/v1/service.js +++ b/lib/rest/ipMessaging/v1/service.js @@ -180,6 +180,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/channel.js b/lib/rest/ipMessaging/v1/service/channel.js index 951673208e..43c6bb5f0b 100644 --- a/lib/rest/ipMessaging/v1/service/channel.js +++ b/lib/rest/ipMessaging/v1/service/channel.js @@ -194,6 +194,8 @@ ChannelList = function ChannelList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/channel/invite.js b/lib/rest/ipMessaging/v1/service/channel/invite.js index 1d5ef2361b..85c16a587d 100644 --- a/lib/rest/ipMessaging/v1/service/channel/invite.js +++ b/lib/rest/ipMessaging/v1/service/channel/invite.js @@ -188,6 +188,8 @@ InviteList = function InviteList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/channel/member.js b/lib/rest/ipMessaging/v1/service/channel/member.js index ac2f1afa0b..66fd3ebcfa 100644 --- a/lib/rest/ipMessaging/v1/service/channel/member.js +++ b/lib/rest/ipMessaging/v1/service/channel/member.js @@ -188,6 +188,8 @@ MemberList = function MemberList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/channel/message.js b/lib/rest/ipMessaging/v1/service/channel/message.js index e132bce4e2..01f751a9f4 100644 --- a/lib/rest/ipMessaging/v1/service/channel/message.js +++ b/lib/rest/ipMessaging/v1/service/channel/message.js @@ -191,6 +191,8 @@ MessageList = function MessageList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/role.js b/lib/rest/ipMessaging/v1/service/role.js index cca69402d2..75f043ddbf 100644 --- a/lib/rest/ipMessaging/v1/service/role.js +++ b/lib/rest/ipMessaging/v1/service/role.js @@ -195,6 +195,8 @@ RoleList = function RoleList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/user.js b/lib/rest/ipMessaging/v1/service/user.js index 55d2b301e4..9c6e22032b 100644 --- a/lib/rest/ipMessaging/v1/service/user.js +++ b/lib/rest/ipMessaging/v1/service/user.js @@ -191,6 +191,8 @@ UserList = function UserList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v1/service/user/userChannel.js b/lib/rest/ipMessaging/v1/service/user/userChannel.js index d7b566785f..c7e2bcb035 100644 --- a/lib/rest/ipMessaging/v1/service/user/userChannel.js +++ b/lib/rest/ipMessaging/v1/service/user/userChannel.js @@ -135,6 +135,8 @@ UserChannelList = function UserChannelList(version, serviceSid, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/credential.js b/lib/rest/ipMessaging/v2/credential.js index 083a4225cc..69d2aae6ad 100644 --- a/lib/rest/ipMessaging/v2/credential.js +++ b/lib/rest/ipMessaging/v2/credential.js @@ -135,6 +135,8 @@ CredentialList = function CredentialList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service.js b/lib/rest/ipMessaging/v2/service.js index 51d30295c3..96f8147ba7 100644 --- a/lib/rest/ipMessaging/v2/service.js +++ b/lib/rest/ipMessaging/v2/service.js @@ -181,6 +181,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/binding.js b/lib/rest/ipMessaging/v2/service/binding.js index 00832e2bb6..cf78cff50a 100644 --- a/lib/rest/ipMessaging/v2/service/binding.js +++ b/lib/rest/ipMessaging/v2/service/binding.js @@ -138,6 +138,8 @@ BindingList = function BindingList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/channel.js b/lib/rest/ipMessaging/v2/service/channel.js index 016f24e1bb..0bea3faeef 100644 --- a/lib/rest/ipMessaging/v2/service/channel.js +++ b/lib/rest/ipMessaging/v2/service/channel.js @@ -204,6 +204,8 @@ ChannelList = function ChannelList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/channel/invite.js b/lib/rest/ipMessaging/v2/service/channel/invite.js index 137365c8a5..36ca124cc7 100644 --- a/lib/rest/ipMessaging/v2/service/channel/invite.js +++ b/lib/rest/ipMessaging/v2/service/channel/invite.js @@ -188,6 +188,8 @@ InviteList = function InviteList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/channel/member.js b/lib/rest/ipMessaging/v2/service/channel/member.js index f34d8eb53f..baa0a31772 100644 --- a/lib/rest/ipMessaging/v2/service/channel/member.js +++ b/lib/rest/ipMessaging/v2/service/channel/member.js @@ -205,6 +205,8 @@ MemberList = function MemberList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/channel/message.js b/lib/rest/ipMessaging/v2/service/channel/message.js index 423a92ea19..e230e42804 100644 --- a/lib/rest/ipMessaging/v2/service/channel/message.js +++ b/lib/rest/ipMessaging/v2/service/channel/message.js @@ -203,6 +203,8 @@ MessageList = function MessageList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/channel/webhook.js b/lib/rest/ipMessaging/v2/service/channel/webhook.js index c6308e674a..9ffe57617a 100644 --- a/lib/rest/ipMessaging/v2/service/channel/webhook.js +++ b/lib/rest/ipMessaging/v2/service/channel/webhook.js @@ -138,6 +138,8 @@ WebhookList = function WebhookList(version, serviceSid, channelSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/role.js b/lib/rest/ipMessaging/v2/service/role.js index fa288a21fc..28d01e6fc8 100644 --- a/lib/rest/ipMessaging/v2/service/role.js +++ b/lib/rest/ipMessaging/v2/service/role.js @@ -195,6 +195,8 @@ RoleList = function RoleList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/user.js b/lib/rest/ipMessaging/v2/service/user.js index 949bcf573d..7faa828e6c 100644 --- a/lib/rest/ipMessaging/v2/service/user.js +++ b/lib/rest/ipMessaging/v2/service/user.js @@ -195,6 +195,8 @@ UserList = function UserList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/user/userBinding.js b/lib/rest/ipMessaging/v2/service/user/userBinding.js index f9310bf4c5..0e63d76643 100644 --- a/lib/rest/ipMessaging/v2/service/user/userBinding.js +++ b/lib/rest/ipMessaging/v2/service/user/userBinding.js @@ -139,6 +139,8 @@ UserBindingList = function UserBindingList(version, serviceSid, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/ipMessaging/v2/service/user/userChannel.js b/lib/rest/ipMessaging/v2/service/user/userChannel.js index 9a7e157e49..8a701b15a8 100644 --- a/lib/rest/ipMessaging/v2/service/user/userChannel.js +++ b/lib/rest/ipMessaging/v2/service/user/userChannel.js @@ -138,6 +138,8 @@ UserChannelList = function UserChannelList(version, serviceSid, userSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/media/v1/mediaProcessor.js b/lib/rest/media/v1/mediaProcessor.js index 8aa74e86f0..e2658ee8f0 100644 --- a/lib/rest/media/v1/mediaProcessor.js +++ b/lib/rest/media/v1/mediaProcessor.js @@ -196,6 +196,8 @@ MediaProcessorList = function MediaProcessorList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/media/v1/playerStreamer.js b/lib/rest/media/v1/playerStreamer.js index d735d85107..cd32f65d98 100644 --- a/lib/rest/media/v1/playerStreamer.js +++ b/lib/rest/media/v1/playerStreamer.js @@ -189,6 +189,8 @@ PlayerStreamerList = function PlayerStreamerList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/brandRegistration.js b/lib/rest/messaging/v1/brandRegistration.js index a330b74a01..f3efead61a 100644 --- a/lib/rest/messaging/v1/brandRegistration.js +++ b/lib/rest/messaging/v1/brandRegistration.js @@ -140,6 +140,8 @@ BrandRegistrationList = function BrandRegistrationList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/brandRegistration/brandVetting.js b/lib/rest/messaging/v1/brandRegistration/brandVetting.js index ebfa7dac53..236d5074bf 100644 --- a/lib/rest/messaging/v1/brandRegistration/brandVetting.js +++ b/lib/rest/messaging/v1/brandRegistration/brandVetting.js @@ -192,6 +192,8 @@ BrandVettingList = function BrandVettingList(version, brandSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/service.js b/lib/rest/messaging/v1/service.js index c8d4068a0e..7a2b46542a 100644 --- a/lib/rest/messaging/v1/service.js +++ b/lib/rest/messaging/v1/service.js @@ -231,6 +231,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/service/alphaSender.js b/lib/rest/messaging/v1/service/alphaSender.js index 3ba66bc837..06eba37113 100644 --- a/lib/rest/messaging/v1/service/alphaSender.js +++ b/lib/rest/messaging/v1/service/alphaSender.js @@ -186,6 +186,8 @@ AlphaSenderList = function AlphaSenderList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/service/phoneNumber.js b/lib/rest/messaging/v1/service/phoneNumber.js index abac17c02c..beafa58240 100644 --- a/lib/rest/messaging/v1/service/phoneNumber.js +++ b/lib/rest/messaging/v1/service/phoneNumber.js @@ -187,6 +187,8 @@ PhoneNumberList = function PhoneNumberList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/service/shortCode.js b/lib/rest/messaging/v1/service/shortCode.js index 31f041a982..a64dd2a7c9 100644 --- a/lib/rest/messaging/v1/service/shortCode.js +++ b/lib/rest/messaging/v1/service/shortCode.js @@ -187,6 +187,8 @@ ShortCodeList = function ShortCodeList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/messaging/v1/service/usAppToPerson.js b/lib/rest/messaging/v1/service/usAppToPerson.js index 74da4dddca..a723565980 100644 --- a/lib/rest/messaging/v1/service/usAppToPerson.js +++ b/lib/rest/messaging/v1/service/usAppToPerson.js @@ -217,6 +217,8 @@ UsAppToPersonList = function UsAppToPersonList(version, messagingServiceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/monitor/v1/alert.js b/lib/rest/monitor/v1/alert.js index ec9491971c..22a20ae116 100644 --- a/lib/rest/monitor/v1/alert.js +++ b/lib/rest/monitor/v1/alert.js @@ -140,6 +140,8 @@ AlertList = function AlertList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/monitor/v1/event.js b/lib/rest/monitor/v1/event.js index a608ed951d..daad4e3c1d 100644 --- a/lib/rest/monitor/v1/event.js +++ b/lib/rest/monitor/v1/event.js @@ -145,6 +145,8 @@ EventList = function EventList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/notify/v1/credential.js b/lib/rest/notify/v1/credential.js index 317d7fa151..5fb4382e8e 100644 --- a/lib/rest/notify/v1/credential.js +++ b/lib/rest/notify/v1/credential.js @@ -138,6 +138,8 @@ CredentialList = function CredentialList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/notify/v1/service.js b/lib/rest/notify/v1/service.js index b25746b7b6..31a8b7a6c6 100644 --- a/lib/rest/notify/v1/service.js +++ b/lib/rest/notify/v1/service.js @@ -218,6 +218,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/notify/v1/service/binding.js b/lib/rest/notify/v1/service/binding.js index 4f32d3d649..7f279be95f 100644 --- a/lib/rest/notify/v1/service/binding.js +++ b/lib/rest/notify/v1/service/binding.js @@ -219,6 +219,8 @@ BindingList = function BindingList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/bundle.js b/lib/rest/numbers/v2/regulatoryCompliance/bundle.js index bfef1134c7..a935326bda 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/bundle.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/bundle.js @@ -207,6 +207,8 @@ BundleList = function BundleList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.js b/lib/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.js index 3d28a04831..c9307fc863 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/bundle/evaluation.js @@ -171,6 +171,8 @@ EvaluationList = function EvaluationList(version, bundleSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.js b/lib/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.js index 515bd6f919..303f326c42 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.js @@ -183,6 +183,8 @@ ItemAssignmentList = function ItemAssignmentList(version, bundleSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/endUser.js b/lib/rest/numbers/v2/regulatoryCompliance/endUser.js index b4de7ab554..99dea116c4 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/endUser.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/endUser.js @@ -188,6 +188,8 @@ EndUserList = function EndUserList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/endUserType.js b/lib/rest/numbers/v2/regulatoryCompliance/endUserType.js index 5f40d8e3e3..9e17644ac4 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/endUserType.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/endUserType.js @@ -132,6 +132,8 @@ EndUserTypeList = function EndUserTypeList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/regulation.js b/lib/rest/numbers/v2/regulatoryCompliance/regulation.js index e4387f0a41..81335d1999 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/regulation.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/regulation.js @@ -137,6 +137,8 @@ RegulationList = function RegulationList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js b/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js index d956e85e3d..93a54852b7 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js @@ -188,6 +188,8 @@ SupportingDocumentList = function SupportingDocumentList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.js b/lib/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.js index aa14852ed7..4b93268d16 100644 --- a/lib/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.js +++ b/lib/rest/numbers/v2/regulatoryCompliance/supportingDocumentType.js @@ -132,6 +132,8 @@ SupportingDocumentTypeList = function SupportingDocumentTypeList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/bulk_exports/export/day.js b/lib/rest/preview/bulk_exports/export/day.js index 19404e47af..6944935611 100644 --- a/lib/rest/preview/bulk_exports/export/day.js +++ b/lib/rest/preview/bulk_exports/export/day.js @@ -140,6 +140,8 @@ DayList = function DayList(version, resourceType) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/bulk_exports/export/exportCustomJob.js b/lib/rest/preview/bulk_exports/export/exportCustomJob.js index 7f0029346c..998aa15696 100644 --- a/lib/rest/preview/bulk_exports/export/exportCustomJob.js +++ b/lib/rest/preview/bulk_exports/export/exportCustomJob.js @@ -137,6 +137,8 @@ ExportCustomJobList = function ExportCustomJobList(version, resourceType) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/deployed_devices/fleet.js b/lib/rest/preview/deployed_devices/fleet.js index 158133fd66..d6004a7154 100644 --- a/lib/rest/preview/deployed_devices/fleet.js +++ b/lib/rest/preview/deployed_devices/fleet.js @@ -184,6 +184,8 @@ FleetList = function FleetList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/deployed_devices/fleet/certificate.js b/lib/rest/preview/deployed_devices/fleet/certificate.js index c15e423b56..63b3ee2e50 100644 --- a/lib/rest/preview/deployed_devices/fleet/certificate.js +++ b/lib/rest/preview/deployed_devices/fleet/certificate.js @@ -196,6 +196,8 @@ CertificateList = function CertificateList(version, fleetSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/deployed_devices/fleet/deployment.js b/lib/rest/preview/deployed_devices/fleet/deployment.js index bb8574f41b..cdcf640416 100644 --- a/lib/rest/preview/deployed_devices/fleet/deployment.js +++ b/lib/rest/preview/deployed_devices/fleet/deployment.js @@ -191,6 +191,8 @@ DeploymentList = function DeploymentList(version, fleetSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/deployed_devices/fleet/device.js b/lib/rest/preview/deployed_devices/fleet/device.js index 2100e88f20..880be1f950 100644 --- a/lib/rest/preview/deployed_devices/fleet/device.js +++ b/lib/rest/preview/deployed_devices/fleet/device.js @@ -199,6 +199,8 @@ DeviceList = function DeviceList(version, fleetSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/deployed_devices/fleet/key.js b/lib/rest/preview/deployed_devices/fleet/key.js index 997c037152..a67ed4dd11 100644 --- a/lib/rest/preview/deployed_devices/fleet/key.js +++ b/lib/rest/preview/deployed_devices/fleet/key.js @@ -193,6 +193,8 @@ KeyList = function KeyList(version, fleetSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/hosted_numbers/authorizationDocument.js b/lib/rest/preview/hosted_numbers/authorizationDocument.js index c803a3e3b7..594ece8fa0 100644 --- a/lib/rest/preview/hosted_numbers/authorizationDocument.js +++ b/lib/rest/preview/hosted_numbers/authorizationDocument.js @@ -144,6 +144,8 @@ AuthorizationDocumentList = function AuthorizationDocumentList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.js b/lib/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.js index abea0c680b..d4d06ba297 100644 --- a/lib/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.js +++ b/lib/rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.js @@ -147,6 +147,8 @@ DependentHostedNumberOrderList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/hosted_numbers/hostedNumberOrder.js b/lib/rest/preview/hosted_numbers/hostedNumberOrder.js index c42b7acc67..86fad398a1 100644 --- a/lib/rest/preview/hosted_numbers/hostedNumberOrder.js +++ b/lib/rest/preview/hosted_numbers/hostedNumberOrder.js @@ -147,6 +147,8 @@ HostedNumberOrderList = function HostedNumberOrderList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/marketplace/availableAddOn.js b/lib/rest/preview/marketplace/availableAddOn.js index dd35f4d59d..678695e99d 100644 --- a/lib/rest/preview/marketplace/availableAddOn.js +++ b/lib/rest/preview/marketplace/availableAddOn.js @@ -138,6 +138,8 @@ AvailableAddOnList = function AvailableAddOnList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/marketplace/availableAddOn/availableAddOnExtension.js b/lib/rest/preview/marketplace/availableAddOn/availableAddOnExtension.js index c9d5653059..7a0f4c6868 100644 --- a/lib/rest/preview/marketplace/availableAddOn/availableAddOnExtension.js +++ b/lib/rest/preview/marketplace/availableAddOn/availableAddOnExtension.js @@ -139,6 +139,8 @@ AvailableAddOnExtensionList = function AvailableAddOnExtensionList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/marketplace/installedAddOn.js b/lib/rest/preview/marketplace/installedAddOn.js index 090371a0e5..53da8e8b7d 100644 --- a/lib/rest/preview/marketplace/installedAddOn.js +++ b/lib/rest/preview/marketplace/installedAddOn.js @@ -198,6 +198,8 @@ InstalledAddOnList = function InstalledAddOnList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/marketplace/installedAddOn/installedAddOnExtension.js b/lib/rest/preview/marketplace/installedAddOn/installedAddOnExtension.js index 4e47b44327..d40a22f82b 100644 --- a/lib/rest/preview/marketplace/installedAddOn/installedAddOnExtension.js +++ b/lib/rest/preview/marketplace/installedAddOn/installedAddOnExtension.js @@ -140,6 +140,8 @@ InstalledAddOnExtensionList = function InstalledAddOnExtensionList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service.js b/lib/rest/preview/sync/service.js index ee2233c86c..44d4ed8827 100644 --- a/lib/rest/preview/sync/service.js +++ b/lib/rest/preview/sync/service.js @@ -192,6 +192,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/document.js b/lib/rest/preview/sync/service/document.js index 54db9702ea..7b70b9fb48 100644 --- a/lib/rest/preview/sync/service/document.js +++ b/lib/rest/preview/sync/service/document.js @@ -192,6 +192,8 @@ DocumentList = function DocumentList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/document/documentPermission.js b/lib/rest/preview/sync/service/document/documentPermission.js index 06c4d1fe2d..45f9315d01 100644 --- a/lib/rest/preview/sync/service/document/documentPermission.js +++ b/lib/rest/preview/sync/service/document/documentPermission.js @@ -141,6 +141,8 @@ DocumentPermissionList = function DocumentPermissionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/syncList.js b/lib/rest/preview/sync/service/syncList.js index e54298d33e..90e4efd41c 100644 --- a/lib/rest/preview/sync/service/syncList.js +++ b/lib/rest/preview/sync/service/syncList.js @@ -188,6 +188,8 @@ SyncListList = function SyncListList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/syncList/syncListItem.js b/lib/rest/preview/sync/service/syncList/syncListItem.js index 0b7f201ffa..90333cdc36 100644 --- a/lib/rest/preview/sync/service/syncList/syncListItem.js +++ b/lib/rest/preview/sync/service/syncList/syncListItem.js @@ -193,6 +193,8 @@ SyncListItemList = function SyncListItemList(version, serviceSid, listSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/syncList/syncListPermission.js b/lib/rest/preview/sync/service/syncList/syncListPermission.js index 362dbc853d..5e3ca0ecfe 100644 --- a/lib/rest/preview/sync/service/syncList/syncListPermission.js +++ b/lib/rest/preview/sync/service/syncList/syncListPermission.js @@ -141,6 +141,8 @@ SyncListPermissionList = function SyncListPermissionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/syncMap.js b/lib/rest/preview/sync/service/syncMap.js index 885bd947c5..a68dd78ce6 100644 --- a/lib/rest/preview/sync/service/syncMap.js +++ b/lib/rest/preview/sync/service/syncMap.js @@ -188,6 +188,8 @@ SyncMapList = function SyncMapList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/syncMap/syncMapItem.js b/lib/rest/preview/sync/service/syncMap/syncMapItem.js index c38d17f0d1..47f5c16253 100644 --- a/lib/rest/preview/sync/service/syncMap/syncMapItem.js +++ b/lib/rest/preview/sync/service/syncMap/syncMapItem.js @@ -197,6 +197,8 @@ SyncMapItemList = function SyncMapItemList(version, serviceSid, mapSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/sync/service/syncMap/syncMapPermission.js b/lib/rest/preview/sync/service/syncMap/syncMapPermission.js index 3db78705ca..3b130a543d 100644 --- a/lib/rest/preview/sync/service/syncMap/syncMapPermission.js +++ b/lib/rest/preview/sync/service/syncMap/syncMapPermission.js @@ -141,6 +141,8 @@ SyncMapPermissionList = function SyncMapPermissionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant.js b/lib/rest/preview/understand/assistant.js index 74dc360715..ad2cf12dc7 100644 --- a/lib/rest/preview/understand/assistant.js +++ b/lib/rest/preview/understand/assistant.js @@ -149,6 +149,8 @@ AssistantList = function AssistantList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/fieldType.js b/lib/rest/preview/understand/assistant/fieldType.js index b65a6b798e..e225495daf 100644 --- a/lib/rest/preview/understand/assistant/fieldType.js +++ b/lib/rest/preview/understand/assistant/fieldType.js @@ -140,6 +140,8 @@ FieldTypeList = function FieldTypeList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/fieldType/fieldValue.js b/lib/rest/preview/understand/assistant/fieldType/fieldValue.js index 2eefac99aa..49bc5ffc97 100644 --- a/lib/rest/preview/understand/assistant/fieldType/fieldValue.js +++ b/lib/rest/preview/understand/assistant/fieldType/fieldValue.js @@ -143,6 +143,8 @@ FieldValueList = function FieldValueList(version, assistantSid, fieldTypeSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/modelBuild.js b/lib/rest/preview/understand/assistant/modelBuild.js index 74245a2ba5..ddeceefcf4 100644 --- a/lib/rest/preview/understand/assistant/modelBuild.js +++ b/lib/rest/preview/understand/assistant/modelBuild.js @@ -139,6 +139,8 @@ ModelBuildList = function ModelBuildList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/query.js b/lib/rest/preview/understand/assistant/query.js index 0d9465e602..0a5bebd857 100644 --- a/lib/rest/preview/understand/assistant/query.js +++ b/lib/rest/preview/understand/assistant/query.js @@ -144,6 +144,8 @@ QueryList = function QueryList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/task.js b/lib/rest/preview/understand/assistant/task.js index f419002eef..1c1991f8eb 100644 --- a/lib/rest/preview/understand/assistant/task.js +++ b/lib/rest/preview/understand/assistant/task.js @@ -144,6 +144,8 @@ TaskList = function TaskList(version, assistantSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/task/field.js b/lib/rest/preview/understand/assistant/task/field.js index 1587cd93ce..b5a38284db 100644 --- a/lib/rest/preview/understand/assistant/task/field.js +++ b/lib/rest/preview/understand/assistant/task/field.js @@ -140,6 +140,8 @@ FieldList = function FieldList(version, assistantSid, taskSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/understand/assistant/task/sample.js b/lib/rest/preview/understand/assistant/task/sample.js index d9968e4bc8..a3ac8e452d 100644 --- a/lib/rest/preview/understand/assistant/task/sample.js +++ b/lib/rest/preview/understand/assistant/task/sample.js @@ -141,6 +141,8 @@ SampleList = function SampleList(version, assistantSid, taskSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/wireless/command.js b/lib/rest/preview/wireless/command.js index 6f9acdd258..cad141a6b8 100644 --- a/lib/rest/preview/wireless/command.js +++ b/lib/rest/preview/wireless/command.js @@ -142,6 +142,8 @@ CommandList = function CommandList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/wireless/ratePlan.js b/lib/rest/preview/wireless/ratePlan.js index 9f0d1ec78c..1438d195ab 100644 --- a/lib/rest/preview/wireless/ratePlan.js +++ b/lib/rest/preview/wireless/ratePlan.js @@ -139,6 +139,8 @@ RatePlanList = function RatePlanList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/preview/wireless/sim.js b/lib/rest/preview/wireless/sim.js index b4e7630a28..51b5d45e90 100644 --- a/lib/rest/preview/wireless/sim.js +++ b/lib/rest/preview/wireless/sim.js @@ -144,6 +144,8 @@ SimList = function SimList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/pricing/v1/messaging/country.js b/lib/rest/pricing/v1/messaging/country.js index 08bd5f1f8a..f6085aa977 100644 --- a/lib/rest/pricing/v1/messaging/country.js +++ b/lib/rest/pricing/v1/messaging/country.js @@ -132,6 +132,8 @@ CountryList = function CountryList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/pricing/v1/phoneNumber/country.js b/lib/rest/pricing/v1/phoneNumber/country.js index 0a1be461de..c260026291 100644 --- a/lib/rest/pricing/v1/phoneNumber/country.js +++ b/lib/rest/pricing/v1/phoneNumber/country.js @@ -132,6 +132,8 @@ CountryList = function CountryList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/pricing/v1/voice/country.js b/lib/rest/pricing/v1/voice/country.js index 607550a4d6..ecc877e748 100644 --- a/lib/rest/pricing/v1/voice/country.js +++ b/lib/rest/pricing/v1/voice/country.js @@ -132,6 +132,8 @@ CountryList = function CountryList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/pricing/v2/country.js b/lib/rest/pricing/v2/country.js index aafb2f4a6c..a945e82429 100644 --- a/lib/rest/pricing/v2/country.js +++ b/lib/rest/pricing/v2/country.js @@ -132,6 +132,8 @@ CountryList = function CountryList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/pricing/v2/voice/country.js b/lib/rest/pricing/v2/voice/country.js index 5955c326d4..c8d48599ce 100644 --- a/lib/rest/pricing/v2/voice/country.js +++ b/lib/rest/pricing/v2/voice/country.js @@ -132,6 +132,8 @@ CountryList = function CountryList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service.js b/lib/rest/proxy/v1/service.js index 11699f445d..db2d68243a 100644 --- a/lib/rest/proxy/v1/service.js +++ b/lib/rest/proxy/v1/service.js @@ -140,6 +140,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service/phoneNumber.js b/lib/rest/proxy/v1/service/phoneNumber.js index b33ac69241..a784c37864 100644 --- a/lib/rest/proxy/v1/service/phoneNumber.js +++ b/lib/rest/proxy/v1/service/phoneNumber.js @@ -193,6 +193,8 @@ PhoneNumberList = function PhoneNumberList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service/session.js b/lib/rest/proxy/v1/service/session.js index 7024f933ee..5bc925e5d9 100644 --- a/lib/rest/proxy/v1/service/session.js +++ b/lib/rest/proxy/v1/service/session.js @@ -141,6 +141,8 @@ SessionList = function SessionList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service/session/interaction.js b/lib/rest/proxy/v1/service/session/interaction.js index 37a32c287b..fbb8defd53 100644 --- a/lib/rest/proxy/v1/service/session/interaction.js +++ b/lib/rest/proxy/v1/service/session/interaction.js @@ -139,6 +139,8 @@ InteractionList = function InteractionList(version, serviceSid, sessionSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service/session/participant.js b/lib/rest/proxy/v1/service/session/participant.js index 95f50cf94e..2b8a620aba 100644 --- a/lib/rest/proxy/v1/service/session/participant.js +++ b/lib/rest/proxy/v1/service/session/participant.js @@ -143,6 +143,8 @@ ParticipantList = function ParticipantList(version, serviceSid, sessionSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service/session/participant/messageInteraction.js b/lib/rest/proxy/v1/service/session/participant/messageInteraction.js index 1a6626a66b..98d05030ad 100644 --- a/lib/rest/proxy/v1/service/session/participant/messageInteraction.js +++ b/lib/rest/proxy/v1/service/session/participant/messageInteraction.js @@ -200,6 +200,8 @@ MessageInteractionList = function MessageInteractionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/proxy/v1/service/shortCode.js b/lib/rest/proxy/v1/service/shortCode.js index 510918c764..e4ebf28b1e 100644 --- a/lib/rest/proxy/v1/service/shortCode.js +++ b/lib/rest/proxy/v1/service/shortCode.js @@ -186,6 +186,8 @@ ShortCodeList = function ShortCodeList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service.js b/lib/rest/serverless/v1/service.js index 98069b1116..4e73ec07a2 100644 --- a/lib/rest/serverless/v1/service.js +++ b/lib/rest/serverless/v1/service.js @@ -142,6 +142,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/asset.js b/lib/rest/serverless/v1/service/asset.js index 0fb486457a..27b075e5db 100644 --- a/lib/rest/serverless/v1/service/asset.js +++ b/lib/rest/serverless/v1/service/asset.js @@ -140,6 +140,8 @@ AssetList = function AssetList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/asset/assetVersion.js b/lib/rest/serverless/v1/service/asset/assetVersion.js index 61dece0d01..1f20191f65 100644 --- a/lib/rest/serverless/v1/service/asset/assetVersion.js +++ b/lib/rest/serverless/v1/service/asset/assetVersion.js @@ -141,6 +141,8 @@ AssetVersionList = function AssetVersionList(version, serviceSid, assetSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/build.js b/lib/rest/serverless/v1/service/build.js index e20f1202ac..296101ba83 100644 --- a/lib/rest/serverless/v1/service/build.js +++ b/lib/rest/serverless/v1/service/build.js @@ -141,6 +141,8 @@ BuildList = function BuildList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/environment.js b/lib/rest/serverless/v1/service/environment.js index 997bfb7931..7b61fc9291 100644 --- a/lib/rest/serverless/v1/service/environment.js +++ b/lib/rest/serverless/v1/service/environment.js @@ -142,6 +142,8 @@ EnvironmentList = function EnvironmentList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/environment/deployment.js b/lib/rest/serverless/v1/service/environment/deployment.js index 1f7b86d925..d7079ca815 100644 --- a/lib/rest/serverless/v1/service/environment/deployment.js +++ b/lib/rest/serverless/v1/service/environment/deployment.js @@ -140,6 +140,8 @@ DeploymentList = function DeploymentList(version, serviceSid, environmentSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/environment/log.js b/lib/rest/serverless/v1/service/environment/log.js index 1023be56eb..2d37269910 100644 --- a/lib/rest/serverless/v1/service/environment/log.js +++ b/lib/rest/serverless/v1/service/environment/log.js @@ -149,6 +149,8 @@ LogList = function LogList(version, serviceSid, environmentSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/environment/variable.js b/lib/rest/serverless/v1/service/environment/variable.js index acfb9d787a..ac75b15eb1 100644 --- a/lib/rest/serverless/v1/service/environment/variable.js +++ b/lib/rest/serverless/v1/service/environment/variable.js @@ -141,6 +141,8 @@ VariableList = function VariableList(version, serviceSid, environmentSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/function.js b/lib/rest/serverless/v1/service/function.js index 2a9cc2ffe6..b1c7ac44fa 100644 --- a/lib/rest/serverless/v1/service/function.js +++ b/lib/rest/serverless/v1/service/function.js @@ -141,6 +141,8 @@ FunctionList = function FunctionList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/serverless/v1/service/function/functionVersion.js b/lib/rest/serverless/v1/service/function/functionVersion.js index ffa2ed29e3..5093a4c8f1 100644 --- a/lib/rest/serverless/v1/service/function/functionVersion.js +++ b/lib/rest/serverless/v1/service/function/functionVersion.js @@ -144,6 +144,8 @@ FunctionVersionList = function FunctionVersionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v1/flow.js b/lib/rest/studio/v1/flow.js index c426bada88..779afd14bc 100644 --- a/lib/rest/studio/v1/flow.js +++ b/lib/rest/studio/v1/flow.js @@ -136,6 +136,8 @@ FlowList = function FlowList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v1/flow/engagement.js b/lib/rest/studio/v1/flow/engagement.js index 85059c1221..1541afcb60 100644 --- a/lib/rest/studio/v1/flow/engagement.js +++ b/lib/rest/studio/v1/flow/engagement.js @@ -139,6 +139,8 @@ EngagementList = function EngagementList(version, flowSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v1/flow/engagement/step.js b/lib/rest/studio/v1/flow/engagement/step.js index 8c9f1dc25f..2428070479 100644 --- a/lib/rest/studio/v1/flow/engagement/step.js +++ b/lib/rest/studio/v1/flow/engagement/step.js @@ -137,6 +137,8 @@ StepList = function StepList(version, flowSid, engagementSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v1/flow/execution.js b/lib/rest/studio/v1/flow/execution.js index cb24dad3bc..af97baf5e7 100644 --- a/lib/rest/studio/v1/flow/execution.js +++ b/lib/rest/studio/v1/flow/execution.js @@ -143,6 +143,8 @@ ExecutionList = function ExecutionList(version, flowSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v1/flow/execution/executionStep.js b/lib/rest/studio/v1/flow/execution/executionStep.js index 4de8d37191..837694fbf6 100644 --- a/lib/rest/studio/v1/flow/execution/executionStep.js +++ b/lib/rest/studio/v1/flow/execution/executionStep.js @@ -138,6 +138,8 @@ ExecutionStepList = function ExecutionStepList(version, flowSid, executionSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v2/flow.js b/lib/rest/studio/v2/flow.js index c291dbf8d8..f967b26f7a 100644 --- a/lib/rest/studio/v2/flow.js +++ b/lib/rest/studio/v2/flow.js @@ -196,6 +196,8 @@ FlowList = function FlowList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v2/flow/execution.js b/lib/rest/studio/v2/flow/execution.js index 4971b72a8c..6db81ad342 100644 --- a/lib/rest/studio/v2/flow/execution.js +++ b/lib/rest/studio/v2/flow/execution.js @@ -143,6 +143,8 @@ ExecutionList = function ExecutionList(version, flowSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v2/flow/execution/executionStep.js b/lib/rest/studio/v2/flow/execution/executionStep.js index 309570d55f..216b134300 100644 --- a/lib/rest/studio/v2/flow/execution/executionStep.js +++ b/lib/rest/studio/v2/flow/execution/executionStep.js @@ -138,6 +138,8 @@ ExecutionStepList = function ExecutionStepList(version, flowSid, executionSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/studio/v2/flow/flowRevision.js b/lib/rest/studio/v2/flow/flowRevision.js index a42d3f6b87..2ce357e16f 100644 --- a/lib/rest/studio/v2/flow/flowRevision.js +++ b/lib/rest/studio/v2/flow/flowRevision.js @@ -135,6 +135,8 @@ FlowRevisionList = function FlowRevisionList(version, sid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/command.js b/lib/rest/supersim/v1/command.js index 7fb8bfa455..ac6464298f 100644 --- a/lib/rest/supersim/v1/command.js +++ b/lib/rest/supersim/v1/command.js @@ -197,6 +197,8 @@ CommandList = function CommandList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/fleet.js b/lib/rest/supersim/v1/fleet.js index d1f0e155e8..9fc7c0af60 100644 --- a/lib/rest/supersim/v1/fleet.js +++ b/lib/rest/supersim/v1/fleet.js @@ -212,6 +212,8 @@ FleetList = function FleetList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/ipCommand.js b/lib/rest/supersim/v1/ipCommand.js index 49800d6389..b1ea96db06 100644 --- a/lib/rest/supersim/v1/ipCommand.js +++ b/lib/rest/supersim/v1/ipCommand.js @@ -208,6 +208,8 @@ IpCommandList = function IpCommandList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/network.js b/lib/rest/supersim/v1/network.js index b38c1417c2..653b402e3d 100644 --- a/lib/rest/supersim/v1/network.js +++ b/lib/rest/supersim/v1/network.js @@ -139,6 +139,8 @@ NetworkList = function NetworkList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/networkAccessProfile.js b/lib/rest/supersim/v1/networkAccessProfile.js index bc5fadb5a1..2c58937045 100644 --- a/lib/rest/supersim/v1/networkAccessProfile.js +++ b/lib/rest/supersim/v1/networkAccessProfile.js @@ -187,6 +187,8 @@ NetworkAccessProfileList = function NetworkAccessProfileList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.js b/lib/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.js index 084fdb3fe8..08a0786c67 100644 --- a/lib/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.js +++ b/lib/rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.js @@ -140,6 +140,8 @@ NetworkAccessProfileNetworkList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/sim.js b/lib/rest/supersim/v1/sim.js index 3f8c43fbdd..5283f4eb32 100644 --- a/lib/rest/supersim/v1/sim.js +++ b/lib/rest/supersim/v1/sim.js @@ -194,6 +194,8 @@ SimList = function SimList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/sim/billingPeriod.js b/lib/rest/supersim/v1/sim/billingPeriod.js index 2a512d1dd6..1aed674662 100644 --- a/lib/rest/supersim/v1/sim/billingPeriod.js +++ b/lib/rest/supersim/v1/sim/billingPeriod.js @@ -134,6 +134,8 @@ BillingPeriodList = function BillingPeriodList(version, simSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/smsCommand.js b/lib/rest/supersim/v1/smsCommand.js index 6b01cc40ef..1e51d8eb79 100644 --- a/lib/rest/supersim/v1/smsCommand.js +++ b/lib/rest/supersim/v1/smsCommand.js @@ -198,6 +198,8 @@ SmsCommandList = function SmsCommandList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/supersim/v1/usageRecord.js b/lib/rest/supersim/v1/usageRecord.js index 4382de2e58..cdb534fbff 100644 --- a/lib/rest/supersim/v1/usageRecord.js +++ b/lib/rest/supersim/v1/usageRecord.js @@ -153,6 +153,8 @@ UsageRecordList = function UsageRecordList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service.js b/lib/rest/sync/v1/service.js index 6f97b4422b..eea8929254 100644 --- a/lib/rest/sync/v1/service.js +++ b/lib/rest/sync/v1/service.js @@ -201,6 +201,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/document.js b/lib/rest/sync/v1/service/document.js index 823c3592b2..32828df2c4 100644 --- a/lib/rest/sync/v1/service/document.js +++ b/lib/rest/sync/v1/service/document.js @@ -194,6 +194,8 @@ DocumentList = function DocumentList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/document/documentPermission.js b/lib/rest/sync/v1/service/document/documentPermission.js index 487df079bf..d3d7adea42 100644 --- a/lib/rest/sync/v1/service/document/documentPermission.js +++ b/lib/rest/sync/v1/service/document/documentPermission.js @@ -138,6 +138,8 @@ DocumentPermissionList = function DocumentPermissionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncList.js b/lib/rest/sync/v1/service/syncList.js index 70e34d0ea8..e48d6fd339 100644 --- a/lib/rest/sync/v1/service/syncList.js +++ b/lib/rest/sync/v1/service/syncList.js @@ -193,6 +193,8 @@ SyncListList = function SyncListList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncList/syncListItem.js b/lib/rest/sync/v1/service/syncList/syncListItem.js index 57f6e42f45..49589fdda8 100644 --- a/lib/rest/sync/v1/service/syncList/syncListItem.js +++ b/lib/rest/sync/v1/service/syncList/syncListItem.js @@ -204,6 +204,8 @@ SyncListItemList = function SyncListItemList(version, serviceSid, listSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncList/syncListPermission.js b/lib/rest/sync/v1/service/syncList/syncListPermission.js index 9ac7e4b98a..72dbcbda68 100644 --- a/lib/rest/sync/v1/service/syncList/syncListPermission.js +++ b/lib/rest/sync/v1/service/syncList/syncListPermission.js @@ -139,6 +139,8 @@ SyncListPermissionList = function SyncListPermissionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncMap.js b/lib/rest/sync/v1/service/syncMap.js index 0ae66d108e..7d40f38f24 100644 --- a/lib/rest/sync/v1/service/syncMap.js +++ b/lib/rest/sync/v1/service/syncMap.js @@ -193,6 +193,8 @@ SyncMapList = function SyncMapList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncMap/syncMapItem.js b/lib/rest/sync/v1/service/syncMap/syncMapItem.js index 4b4a4f7b03..6fde8ab4e8 100644 --- a/lib/rest/sync/v1/service/syncMap/syncMapItem.js +++ b/lib/rest/sync/v1/service/syncMap/syncMapItem.js @@ -209,6 +209,8 @@ SyncMapItemList = function SyncMapItemList(version, serviceSid, mapSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncMap/syncMapPermission.js b/lib/rest/sync/v1/service/syncMap/syncMapPermission.js index 330ebf270e..cd1828a2bf 100644 --- a/lib/rest/sync/v1/service/syncMap/syncMapPermission.js +++ b/lib/rest/sync/v1/service/syncMap/syncMapPermission.js @@ -138,6 +138,8 @@ SyncMapPermissionList = function SyncMapPermissionList(version, serviceSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/sync/v1/service/syncStream.js b/lib/rest/sync/v1/service/syncStream.js index b7dfddc241..3e04429f5e 100644 --- a/lib/rest/sync/v1/service/syncStream.js +++ b/lib/rest/sync/v1/service/syncStream.js @@ -186,6 +186,8 @@ SyncStreamList = function SyncStreamList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace.js b/lib/rest/taskrouter/v1/workspace.js index 4cffee31b3..327b2c39dd 100644 --- a/lib/rest/taskrouter/v1/workspace.js +++ b/lib/rest/taskrouter/v1/workspace.js @@ -150,6 +150,8 @@ WorkspaceList = function WorkspaceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/activity.js b/lib/rest/taskrouter/v1/workspace/activity.js index ab3f1a0119..6839abaacb 100644 --- a/lib/rest/taskrouter/v1/workspace/activity.js +++ b/lib/rest/taskrouter/v1/workspace/activity.js @@ -141,6 +141,8 @@ ActivityList = function ActivityList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/event.js b/lib/rest/taskrouter/v1/workspace/event.js index 75e3edc720..2b41d58ed4 100644 --- a/lib/rest/taskrouter/v1/workspace/event.js +++ b/lib/rest/taskrouter/v1/workspace/event.js @@ -151,6 +151,8 @@ EventList = function EventList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/task.js b/lib/rest/taskrouter/v1/workspace/task.js index af9d29097f..e67b6b12e0 100644 --- a/lib/rest/taskrouter/v1/workspace/task.js +++ b/lib/rest/taskrouter/v1/workspace/task.js @@ -152,6 +152,8 @@ TaskList = function TaskList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/task/reservation.js b/lib/rest/taskrouter/v1/workspace/task/reservation.js index 60fa8c0145..2374b04b54 100644 --- a/lib/rest/taskrouter/v1/workspace/task/reservation.js +++ b/lib/rest/taskrouter/v1/workspace/task/reservation.js @@ -141,6 +141,8 @@ ReservationList = function ReservationList(version, workspaceSid, taskSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/taskChannel.js b/lib/rest/taskrouter/v1/workspace/taskChannel.js index 5729df24b7..bab5ecb321 100644 --- a/lib/rest/taskrouter/v1/workspace/taskChannel.js +++ b/lib/rest/taskrouter/v1/workspace/taskChannel.js @@ -137,6 +137,8 @@ TaskChannelList = function TaskChannelList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/taskQueue.js b/lib/rest/taskrouter/v1/workspace/taskQueue.js index 76d7446c3d..2259698803 100644 --- a/lib/rest/taskrouter/v1/workspace/taskQueue.js +++ b/lib/rest/taskrouter/v1/workspace/taskQueue.js @@ -154,6 +154,8 @@ TaskQueueList = function TaskQueueList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.js b/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.js index b1a0222d1e..c376bf5205 100644 --- a/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.js +++ b/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.js @@ -148,6 +148,8 @@ TaskQueuesStatisticsList = function TaskQueuesStatisticsList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/worker.js b/lib/rest/taskrouter/v1/workspace/worker.js index 63c7615c13..e656a36892 100644 --- a/lib/rest/taskrouter/v1/workspace/worker.js +++ b/lib/rest/taskrouter/v1/workspace/worker.js @@ -164,6 +164,8 @@ WorkerList = function WorkerList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/worker/reservation.js b/lib/rest/taskrouter/v1/workspace/worker/reservation.js index 52f5c36881..86e4f8abe4 100644 --- a/lib/rest/taskrouter/v1/workspace/worker/reservation.js +++ b/lib/rest/taskrouter/v1/workspace/worker/reservation.js @@ -141,6 +141,8 @@ ReservationList = function ReservationList(version, workspaceSid, workerSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/worker/workerChannel.js b/lib/rest/taskrouter/v1/workspace/worker/workerChannel.js index 9ab1e5cfb1..cb8795897d 100644 --- a/lib/rest/taskrouter/v1/workspace/worker/workerChannel.js +++ b/lib/rest/taskrouter/v1/workspace/worker/workerChannel.js @@ -141,6 +141,8 @@ WorkerChannelList = function WorkerChannelList(version, workspaceSid, workerSid) if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/taskrouter/v1/workspace/workflow.js b/lib/rest/taskrouter/v1/workspace/workflow.js index 0bc324b04e..080d3d844c 100644 --- a/lib/rest/taskrouter/v1/workspace/workflow.js +++ b/lib/rest/taskrouter/v1/workspace/workflow.js @@ -144,6 +144,8 @@ WorkflowList = function WorkflowList(version, workspaceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trunking/v1/trunk.js b/lib/rest/trunking/v1/trunk.js index 21d9b6e02a..ac7ec88f14 100644 --- a/lib/rest/trunking/v1/trunk.js +++ b/lib/rest/trunking/v1/trunk.js @@ -205,6 +205,8 @@ TrunkList = function TrunkList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trunking/v1/trunk/credentialList.js b/lib/rest/trunking/v1/trunk/credentialList.js index cb436e5863..81101a4f77 100644 --- a/lib/rest/trunking/v1/trunk/credentialList.js +++ b/lib/rest/trunking/v1/trunk/credentialList.js @@ -184,6 +184,8 @@ CredentialListList = function CredentialListList(version, trunkSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trunking/v1/trunk/ipAccessControlList.js b/lib/rest/trunking/v1/trunk/ipAccessControlList.js index e807b3f022..9a9379b11c 100644 --- a/lib/rest/trunking/v1/trunk/ipAccessControlList.js +++ b/lib/rest/trunking/v1/trunk/ipAccessControlList.js @@ -183,6 +183,8 @@ IpAccessControlListList = function IpAccessControlListList(version, trunkSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trunking/v1/trunk/originationUrl.js b/lib/rest/trunking/v1/trunk/originationUrl.js index ead7c98bf6..c015aeb782 100644 --- a/lib/rest/trunking/v1/trunk/originationUrl.js +++ b/lib/rest/trunking/v1/trunk/originationUrl.js @@ -207,6 +207,8 @@ OriginationUrlList = function OriginationUrlList(version, trunkSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trunking/v1/trunk/phoneNumber.js b/lib/rest/trunking/v1/trunk/phoneNumber.js index 017e2b9fac..14dea6047d 100644 --- a/lib/rest/trunking/v1/trunk/phoneNumber.js +++ b/lib/rest/trunking/v1/trunk/phoneNumber.js @@ -184,6 +184,8 @@ PhoneNumberList = function PhoneNumberList(version, trunkSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/customerProfiles.js b/lib/rest/trusthub/v1/customerProfiles.js index 7af18c1af5..21e686f918 100644 --- a/lib/rest/trusthub/v1/customerProfiles.js +++ b/lib/rest/trusthub/v1/customerProfiles.js @@ -203,6 +203,8 @@ CustomerProfilesList = function CustomerProfilesList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.js b/lib/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.js index ffdbcdb0d1..32beb2a646 100644 --- a/lib/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.js +++ b/lib/rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.js @@ -198,6 +198,8 @@ CustomerProfilesChannelEndpointAssignmentList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.js b/lib/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.js index 4fca14117f..6fb6d45082 100644 --- a/lib/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.js +++ b/lib/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.js @@ -186,6 +186,8 @@ CustomerProfilesEntityAssignmentsList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.js b/lib/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.js index 075320629d..5045ded459 100644 --- a/lib/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.js +++ b/lib/rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.js @@ -185,6 +185,8 @@ CustomerProfilesEvaluationsList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/endUser.js b/lib/rest/trusthub/v1/endUser.js index 609df5fb49..4fa84a4cff 100644 --- a/lib/rest/trusthub/v1/endUser.js +++ b/lib/rest/trusthub/v1/endUser.js @@ -188,6 +188,8 @@ EndUserList = function EndUserList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/endUserType.js b/lib/rest/trusthub/v1/endUserType.js index 197c8f1002..b343479395 100644 --- a/lib/rest/trusthub/v1/endUserType.js +++ b/lib/rest/trusthub/v1/endUserType.js @@ -132,6 +132,8 @@ EndUserTypeList = function EndUserTypeList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/policies.js b/lib/rest/trusthub/v1/policies.js index 6ad677253e..07f20750ba 100644 --- a/lib/rest/trusthub/v1/policies.js +++ b/lib/rest/trusthub/v1/policies.js @@ -132,6 +132,8 @@ PoliciesList = function PoliciesList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/supportingDocument.js b/lib/rest/trusthub/v1/supportingDocument.js index f47dea2aed..e0009c945f 100644 --- a/lib/rest/trusthub/v1/supportingDocument.js +++ b/lib/rest/trusthub/v1/supportingDocument.js @@ -188,6 +188,8 @@ SupportingDocumentList = function SupportingDocumentList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/supportingDocumentType.js b/lib/rest/trusthub/v1/supportingDocumentType.js index 7eeead7cb0..a9836d7d42 100644 --- a/lib/rest/trusthub/v1/supportingDocumentType.js +++ b/lib/rest/trusthub/v1/supportingDocumentType.js @@ -132,6 +132,8 @@ SupportingDocumentTypeList = function SupportingDocumentTypeList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/trustProducts.js b/lib/rest/trusthub/v1/trustProducts.js index 618cecad8c..154a58a969 100644 --- a/lib/rest/trusthub/v1/trustProducts.js +++ b/lib/rest/trusthub/v1/trustProducts.js @@ -203,6 +203,8 @@ TrustProductsList = function TrustProductsList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.js b/lib/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.js index cefdc488f4..0ea0f29255 100644 --- a/lib/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.js +++ b/lib/rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.js @@ -196,6 +196,8 @@ TrustProductsChannelEndpointAssignmentList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.js b/lib/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.js index 7955dfd9ee..4def6c290b 100644 --- a/lib/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.js +++ b/lib/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.js @@ -186,6 +186,8 @@ TrustProductsEntityAssignmentsList = function if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/trusthub/v1/trustProducts/trustProductsEvaluations.js b/lib/rest/trusthub/v1/trustProducts/trustProductsEvaluations.js index 7ffe672498..5bc990b7e7 100644 --- a/lib/rest/trusthub/v1/trustProducts/trustProductsEvaluations.js +++ b/lib/rest/trusthub/v1/trustProducts/trustProductsEvaluations.js @@ -183,6 +183,8 @@ TrustProductsEvaluationsList = function TrustProductsEvaluationsList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service.js b/lib/rest/verify/v2/service.js index a3b5aa663a..b6102d2975 100644 --- a/lib/rest/verify/v2/service.js +++ b/lib/rest/verify/v2/service.js @@ -236,6 +236,8 @@ ServiceList = function ServiceList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/entity.js b/lib/rest/verify/v2/service/entity.js index 377e42411d..1ea3b2f430 100644 --- a/lib/rest/verify/v2/service/entity.js +++ b/lib/rest/verify/v2/service/entity.js @@ -188,6 +188,8 @@ EntityList = function EntityList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/entity/challenge.js b/lib/rest/verify/v2/service/entity/challenge.js index c19a0744f6..d2c52c3f1e 100644 --- a/lib/rest/verify/v2/service/entity/challenge.js +++ b/lib/rest/verify/v2/service/entity/challenge.js @@ -210,6 +210,8 @@ ChallengeList = function ChallengeList(version, serviceSid, identity) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/entity/factor.js b/lib/rest/verify/v2/service/entity/factor.js index 460d34ab3b..3aa4361971 100644 --- a/lib/rest/verify/v2/service/entity/factor.js +++ b/lib/rest/verify/v2/service/entity/factor.js @@ -139,6 +139,8 @@ FactorList = function FactorList(version, serviceSid, identity) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/messagingConfiguration.js b/lib/rest/verify/v2/service/messagingConfiguration.js index 484135f000..2abd1f82b8 100644 --- a/lib/rest/verify/v2/service/messagingConfiguration.js +++ b/lib/rest/verify/v2/service/messagingConfiguration.js @@ -193,6 +193,8 @@ MessagingConfigurationList = function MessagingConfigurationList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/rateLimit.js b/lib/rest/verify/v2/service/rateLimit.js index 5b090226db..363d95f511 100644 --- a/lib/rest/verify/v2/service/rateLimit.js +++ b/lib/rest/verify/v2/service/rateLimit.js @@ -189,6 +189,8 @@ RateLimitList = function RateLimitList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/rateLimit/bucket.js b/lib/rest/verify/v2/service/rateLimit/bucket.js index dcba8644f9..c116995f56 100644 --- a/lib/rest/verify/v2/service/rateLimit/bucket.js +++ b/lib/rest/verify/v2/service/rateLimit/bucket.js @@ -190,6 +190,8 @@ BucketList = function BucketList(version, serviceSid, rateLimitSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/service/webhook.js b/lib/rest/verify/v2/service/webhook.js index 42d296156a..2be528512d 100644 --- a/lib/rest/verify/v2/service/webhook.js +++ b/lib/rest/verify/v2/service/webhook.js @@ -204,6 +204,8 @@ WebhookList = function WebhookList(version, serviceSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/template.js b/lib/rest/verify/v2/template.js index 6ad08bb935..fa5cb55d5d 100644 --- a/lib/rest/verify/v2/template.js +++ b/lib/rest/verify/v2/template.js @@ -132,6 +132,8 @@ TemplateList = function TemplateList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/verify/v2/verificationAttempt.js b/lib/rest/verify/v2/verificationAttempt.js index 7693d86418..ccc829f195 100644 --- a/lib/rest/verify/v2/verificationAttempt.js +++ b/lib/rest/verify/v2/verificationAttempt.js @@ -140,6 +140,8 @@ VerificationAttemptList = function VerificationAttemptList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/composition.js b/lib/rest/video/v1/composition.js index 3e0466d20b..a47520b2f5 100644 --- a/lib/rest/video/v1/composition.js +++ b/lib/rest/video/v1/composition.js @@ -143,6 +143,8 @@ CompositionList = function CompositionList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/compositionHook.js b/lib/rest/video/v1/compositionHook.js index 40fa0e8791..6badd838bf 100644 --- a/lib/rest/video/v1/compositionHook.js +++ b/lib/rest/video/v1/compositionHook.js @@ -143,6 +143,8 @@ CompositionHookList = function CompositionHookList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/recording.js b/lib/rest/video/v1/recording.js index 7e81b27fd1..7cf27d9558 100644 --- a/lib/rest/video/v1/recording.js +++ b/lib/rest/video/v1/recording.js @@ -147,6 +147,8 @@ RecordingList = function RecordingList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/room.js b/lib/rest/video/v1/room.js index 97762c268c..d44ae7b99c 100644 --- a/lib/rest/video/v1/room.js +++ b/lib/rest/video/v1/room.js @@ -225,6 +225,8 @@ RoomList = function RoomList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/room/recording.js b/lib/rest/video/v1/room/recording.js index 23bbfb72ce..4c7b9f025d 100644 --- a/lib/rest/video/v1/room/recording.js +++ b/lib/rest/video/v1/room/recording.js @@ -145,6 +145,8 @@ RoomRecordingList = function RoomRecordingList(version, roomSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/room/roomParticipant.js b/lib/rest/video/v1/room/roomParticipant.js index a8b4094597..d27614fb8f 100644 --- a/lib/rest/video/v1/room/roomParticipant.js +++ b/lib/rest/video/v1/room/roomParticipant.js @@ -150,6 +150,8 @@ ParticipantList = function ParticipantList(version, roomSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/room/roomParticipant/roomParticipantPublishedTrack.js b/lib/rest/video/v1/room/roomParticipant/roomParticipantPublishedTrack.js index 4c36c567a7..9df06b990e 100644 --- a/lib/rest/video/v1/room/roomParticipant/roomParticipantPublishedTrack.js +++ b/lib/rest/video/v1/room/roomParticipant/roomParticipantPublishedTrack.js @@ -139,6 +139,8 @@ PublishedTrackList = function PublishedTrackList(version, roomSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/video/v1/room/roomParticipant/roomParticipantSubscribedTrack.js b/lib/rest/video/v1/room/roomParticipant/roomParticipantSubscribedTrack.js index 18310a64b0..4b7570b550 100644 --- a/lib/rest/video/v1/room/roomParticipant/roomParticipantSubscribedTrack.js +++ b/lib/rest/video/v1/room/roomParticipant/roomParticipantSubscribedTrack.js @@ -138,6 +138,8 @@ SubscribedTrackList = function SubscribedTrackList(version, roomSid, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/byocTrunk.js b/lib/rest/voice/v1/byocTrunk.js index 1030909444..23cbb6f9ff 100644 --- a/lib/rest/voice/v1/byocTrunk.js +++ b/lib/rest/voice/v1/byocTrunk.js @@ -203,6 +203,8 @@ ByocTrunkList = function ByocTrunkList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/connectionPolicy.js b/lib/rest/voice/v1/connectionPolicy.js index f3936fcac6..3268401b91 100644 --- a/lib/rest/voice/v1/connectionPolicy.js +++ b/lib/rest/voice/v1/connectionPolicy.js @@ -177,6 +177,8 @@ ConnectionPolicyList = function ConnectionPolicyList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/connectionPolicy/connectionPolicyTarget.js b/lib/rest/voice/v1/connectionPolicy/connectionPolicyTarget.js index 061ef098bb..43fde14a1c 100644 --- a/lib/rest/voice/v1/connectionPolicy/connectionPolicyTarget.js +++ b/lib/rest/voice/v1/connectionPolicy/connectionPolicyTarget.js @@ -197,6 +197,8 @@ ConnectionPolicyTargetList = function ConnectionPolicyTargetList(version, if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/dialingPermissions/country.js b/lib/rest/voice/v1/dialingPermissions/country.js index 5896d23588..83145d3ba0 100644 --- a/lib/rest/voice/v1/dialingPermissions/country.js +++ b/lib/rest/voice/v1/dialingPermissions/country.js @@ -150,6 +150,8 @@ CountryList = function CountryList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.js b/lib/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.js index f98c906d38..1040e317f5 100644 --- a/lib/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.js +++ b/lib/rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.js @@ -137,6 +137,8 @@ HighriskSpecialPrefixList = function HighriskSpecialPrefixList(version, isoCode) if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/ipRecord.js b/lib/rest/voice/v1/ipRecord.js index 6890aaacbb..0bbd450525 100644 --- a/lib/rest/voice/v1/ipRecord.js +++ b/lib/rest/voice/v1/ipRecord.js @@ -184,6 +184,8 @@ IpRecordList = function IpRecordList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/voice/v1/sourceIpMapping.js b/lib/rest/voice/v1/sourceIpMapping.js index 83c8984ff7..9eda877d1f 100644 --- a/lib/rest/voice/v1/sourceIpMapping.js +++ b/lib/rest/voice/v1/sourceIpMapping.js @@ -185,6 +185,8 @@ SourceIpMappingList = function SourceIpMappingList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/wireless/v1/command.js b/lib/rest/wireless/v1/command.js index 425ddce6b5..af2f8ba39c 100644 --- a/lib/rest/wireless/v1/command.js +++ b/lib/rest/wireless/v1/command.js @@ -141,6 +141,8 @@ CommandList = function CommandList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/wireless/v1/ratePlan.js b/lib/rest/wireless/v1/ratePlan.js index 244e9f40e1..34c86a74f9 100644 --- a/lib/rest/wireless/v1/ratePlan.js +++ b/lib/rest/wireless/v1/ratePlan.js @@ -135,6 +135,8 @@ RatePlanList = function RatePlanList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/wireless/v1/sim.js b/lib/rest/wireless/v1/sim.js index 9c21664f0a..866c9f51e1 100644 --- a/lib/rest/wireless/v1/sim.js +++ b/lib/rest/wireless/v1/sim.js @@ -143,6 +143,8 @@ SimList = function SimList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/wireless/v1/sim/dataSession.js b/lib/rest/wireless/v1/sim/dataSession.js index dc105c24a5..f38c7ca096 100644 --- a/lib/rest/wireless/v1/sim/dataSession.js +++ b/lib/rest/wireless/v1/sim/dataSession.js @@ -135,6 +135,8 @@ DataSessionList = function DataSessionList(version, simSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/wireless/v1/sim/usageRecord.js b/lib/rest/wireless/v1/sim/usageRecord.js index 2ed30fac20..a6589d7286 100644 --- a/lib/rest/wireless/v1/sim/usageRecord.js +++ b/lib/rest/wireless/v1/sim/usageRecord.js @@ -140,6 +140,8 @@ UsageRecordList = function UsageRecordList(version, simSid) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/lib/rest/wireless/v1/usageRecord.js b/lib/rest/wireless/v1/usageRecord.js index 72b31d496f..5ceed20f5c 100644 --- a/lib/rest/wireless/v1/usageRecord.js +++ b/lib/rest/wireless/v1/usageRecord.js @@ -138,6 +138,8 @@ UsageRecordList = function UsageRecordList(version) { if (!done) { currentPage++; fetchNextPage(_.bind(page.nextPage, page)); + } else { + onComplete(); } }); diff --git a/spec/unit/rest/incomingPhoneNumber.spec.js b/spec/unit/rest/incomingPhoneNumber.spec.js new file mode 100644 index 0000000000..267e4a9ffe --- /dev/null +++ b/spec/unit/rest/incomingPhoneNumber.spec.js @@ -0,0 +1,56 @@ +'use strict'; + +var Holodeck = require('../../integration/holodeck'); +var Response = require('../../../lib/http/response'); +var Twilio = require('../../../lib'); + +var client; +var holodeck; + +describe('IncomingPhoneNumber', function () { + /* Before Hooks */ + beforeEach(function() { + holodeck = new Holodeck(); + client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', { + httpClient: holodeck + }); + }); + + /* Tests */ + it('should call done in the opts object when done', + function (done) { + var body = { + 'end': 0, + 'first_page_uri': '/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0', + 'incoming_phone_numbers': [{}], + 'next_page_uri': null, + 'page': 0, + 'page_size': 50, + 'previous_page_uri': null, + 'start': 0, + 'uri': '/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=50&Page=0' + }; + holodeck.mock(new Response(200, body)); + client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .incomingPhoneNumbers.each({ done }, () => null); + } + ); + it('should call done when limit in the opts object is reached', + function (done) { + var body = { + 'end': 0, + 'first_page_uri': '/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=1&Page=0', + 'incoming_phone_numbers': [{}], + 'next_page_uri': '/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=1&Page=1', + 'page': 0, + 'page_size': 1, + 'previous_page_uri': null, + 'start': 0, + 'uri': '/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers.json?FriendlyName=friendly_name&Beta=true&PhoneNumber=%2B19876543210&PageSize=1&Page=0' + }; + holodeck.mock(new Response(200, body)); + client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .incomingPhoneNumbers.each({ limit: 1, done }, () => null); + } + ); +});