Flux.REST: Customizable pagination
Opened this issue · 1 comments
YuriyDurov commented
We need to allow users to configure their pagination logic, like configuring offset/limit parameter names, allow additional pagination parameter schemas, and allow custom PageResult models mapping.
Query parameters implementation: #5
YuriyDurov commented
Some thoughts on this:
builder.Services.AddFlux(flux =>
{
flux.AddService("MyExternalSite")
.UsingRest("https://my-external-site.com/api/")
.ConfigurePagination( // Global pagination config for entire Service
(pageRequest) =>
{
}
(httpResponse) =>
{
return PageResult;
})
.AddSet<Parent>()
.WithEndpoint("parents")
.ConfigurePagination( // pagination config for this Set
(pageRequest) =>
{
}
(httpResponse) =>
{
return PageResult<Parent>;
})
.AddSet<ModelDto>()
.WithEndpoint("my-model") // https://my-external-site.com/api/my-model
.WithPageEndpoint("parents/{parentId}/my-models")
.ConfigurePagination( // pagination config for this Set
(pageRequest) =>
{
}
(httpResponse) =>
{
return PageResult<Parent>;
})
});