AlessandroSechi / zammad-go

BSD 3-Clause "New" or "Revised" License
11 stars 7 forks source link

Implement pagination #9

Closed miekg closed 1 week ago

miekg commented 4 months ago

See https://docs.zammad.org/en/latest/api/intro.html#pagination

Probably nicest to do this implicit, and make the API just gather all JSON and return a giant list; downside is that this will cost a memory, OTOH what woud be large ? total number of ticket and/or per ticket articles

AlessandroSechi commented 4 months ago

What if we implement Next() method with proper receiver? We should store per_page, sort_ by and order_by (so ordering is coherent) so user of library can just call Next() and get next page of results. We could also add a FetchAll() to fetch all list as you suggested, which will just use Next() under the hood to retrive whole list.

miekg commented 4 months ago

Next() is a nice idea!

AlessandroSechi commented 4 months ago

Ok, will take care of that