Skip to content

Commit

Permalink
Revert "Ease pagination usage"
Browse files Browse the repository at this point in the history
This reverts commit 24ceeea.
  • Loading branch information
jakublabno committed Jan 2, 2025
1 parent 2e74ac4 commit 4da2144
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 186 deletions.
30 changes: 24 additions & 6 deletions examples/Pagination.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,29 @@
var client = new ClientOAuth("token");
var features = new Features(client);

var list = features.Sendernames()
.List()
.ToIterator();
var listSendernames = (uint collectionLimit, uint collectionOffset) =>
{
var list = features.Sendernames().List();

list.Limit = collectionLimit;
list.Offset = collectionOffset;

return list.Execute();
};

foreach (var sendername in list)
const uint limit = 25;
uint offset = 0;
bool hasMoreItems;

do
{
Console.WriteLine(sendername.Sender);
}
var sendernames = listSendernames(limit, offset);

sendernames.Collection.ForEach(sendername =>
{
Console.WriteLine($"Sender: {sendername.Sender}");
});

hasMoreItems = sendernames.Size > limit + offset;
offset += limit;
} while (hasMoreItems);
96 changes: 0 additions & 96 deletions smsapi/Api/Action/CollectionIterator.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public DeserializationResult<T> Deserialize<T>(HttpResponseEntity responseEntity
{
throw new HostException(e.Message, HostException.E_JSON_DECODE);
}
finally
{
data?.Close();
}

return response;
}
Expand Down
84 changes: 0 additions & 84 deletions smsapiTests/Unit/Action/CollectionIteratorTest.cs

This file was deleted.

0 comments on commit 4da2144

Please sign in to comment.