[Bug]: numbers.getOwnedNumbers does not return all numbers
tapz opened this issue · 2 comments
tapz commented
Node Version
20.x
Platform
Mac (Apple Silcon)
SDK Version
3.10.0
Code Sample
const numbers = [];
let totalCount = 100;
while (numbers.length < totalCount) {
const res = await vonage.numbers.getOwnedNumbers({
country: '',
applicationId: appId || '',
index: numbers.length + 1,
size: Math.min(totalCount - numbers.length, 100)
});
console.log(res);
if (res.count) {
totalCount = res.count;
}
if (res.numbers) {
numbers.push(...res.numbers);
} else {
break;
}
}
Expected Behavior
All numbers should be returned, page by page.
Actual Behavior
If the page size is 10, you can call the api 6 times to get totally 60 numbers. All further request with page index > 6 return an empty response . If the page size is 100, you can call the api only once and get the first 100 numbers. All further requests with page index > 1 return a response {}
. The count returned in the first response is 589, so why doesn't the api/sdk return the rest of the numbers? The paging system clearly does not work at all.
tapz commented
The index seems to be a PAGE index, not an offset.