You can either keep looping until your offset is greater than the _total, or you can divide the _total by your offset increment (in this case, 100) and round up, which will give the number of times you need to loop. Either way will stop the loop once you’ve got all the results the API will give.