Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flux.REST: Customizable pagination #4

Open
YuriyDurov opened this issue Sep 30, 2023 · 1 comment
Open

Flux.REST: Customizable pagination #4

YuriyDurov opened this issue Sep 30, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@YuriyDurov
Copy link
Member

YuriyDurov commented Sep 30, 2023

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 YuriyDurov added the enhancement New feature or request label Sep 30, 2023
@YuriyDurov YuriyDurov added this to the Flux v1.0 milestone Sep 30, 2023
@YuriyDurov YuriyDurov changed the title Customizable pagination Flux.REST: Customizable pagination Sep 30, 2023
@YuriyDurov
Copy link
Member Author

YuriyDurov commented Jan 3, 2024

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>;
                  })
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant