AutoQuery Data ServiceSource paging

Is there a way to consume a paged API via an AutoQuery ServiceSource? i.e. is there are a way to create a custom AutoQuery Data implementation that handles skip/take and passes it to the underlying API?

The ServiceClients GetLazy() API can consume an AutoQuery Services over an IEnumerable which will send multiple paged requests behind the scenes.

Yes, but if the the source of the AutoQuery Service is a paged API itself? I want to wire up an API that has paging (but little else) to AutoQuery so I can leverage AutoQuery’s filtering capabilities. Do I have to essentially implement a GetLazy() approach for the source API, then hand the results over to AutoQuery?

Not sure I know what you’re looking for, if you’re implementing ServiceSource you have control over entire the implementation so you can just forward the paged params to the API it’s calling? What’s the underlying API another AutoQuery Service?

It’s a Cassandra DB that I’m accessing through a client library. I have one route that gets all the connections:

[Route("/vpn/connections", "GET", Summary = "Gets all Vpn connections")]
public class GetVpnConnections : IReturn<List<VpnConnection>>
{
    
}

And another that uses the above as a AutoQuery Service:

[Route("/vpn/connections/search", "GET", Summary = "Search VPN connection information")]
public class SearchVpnConnections : QueryData<VpnConnection>
{
    
}

associated line in Global.asax:

//Other datasources above this
.AddDataSource(ctx =>ctx.ServiceSource<VpnConnection>(new GetVpnConnections(), HostContext.Cache, TimeSpan.FromSeconds(60))));

I use this pattern when I want to leverage all the parameters that AutoQuery wires up automatically (including particular fields, filtering/sorting etc…) So if I want to modify things to pass paging parameters, would I just add Skip and Take Parameters to the two classes above (and handle them in the underlying cassandra code)?

I should clarify that I know AutoQuery itself does paging, but I’d like to lessen the initial load on GetVpnConnections (as is it’s returning all the rows).

The AutoQuery QueryData<T> base class already has Skip/Take fields so you should just be able to pass that through to the Cassandra Query right?

Right, that’s what I thought, I would just trying to figure out how things like the Total number of results work in that case… if the fetch call is only pulling in 100 records at a time (passed in from QueryData), how does AutoQuery know how many total records are there (assuming no other filtering)?

Apologies if I’m missing something obvious.

Right It can’t know how many total results there are. To reduce load you could cap the results from the underlying API to 1000 or temporarily cache the results so the clients are only paging through an in memory result set.