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

Add standardized models for cursor based pagination #949

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.48.3] - 2023-11-28
- Add standardized models for cursor based pagination

## [29.48.2] - 2023-11-27
- Remove usage of Optional from SimpleLoadBalancer

Expand Down Expand Up @@ -5569,7 +5572,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.48.2...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.48.3...master
[29.48.3]: https://github.com/linkedin/rest.li/compare/v29.48.2...v29.48.3
[29.48.2]: https://github.com/linkedin/rest.li/compare/v29.48.1...v29.48.2
[29.48.1]: https://github.com/linkedin/rest.li/compare/v29.48.0...v29.48.1
[29.48.0]: https://github.com/linkedin/rest.li/compare/v29.47.0...v29.48.0
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.48.2
version=29.48.3
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace com.linkedin.restli.common

/**
* Metadata for cursor based pagination with collections.
*/
record CursorPagination {

/**
* Pagination cursor that points to the end of the current page and can be used to fetch the next page.
* Not populated if the current page is the last page.
*/
next: optional string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type" : "record",
"name" : "CursorPagination",
"namespace" : "com.linkedin.restli.common",
"doc" : "Metadata for cursor based pagination with collections.",
"fields" : [ {
"name" : "next",
"type" : "string",
"doc" : "Pagination cursor that points to the end of the current page and can be used to fetch the next page.\nNot populated if the current page is the last page.",
"optional" : true
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.linkedin.restli.server;

import com.linkedin.data.template.RecordTemplate;
import com.linkedin.restli.common.CursorPagination;
import java.util.List;


/**
* Convenience extension to {@link CollectionResult} for use with cursor based pagination.
*/
public class CursorCollectionResult<T extends RecordTemplate> extends CollectionResult<T, CursorPagination>
{
/**
* Constructor
*
* @param elements List of elements in the current page.
* @param pagination The cursor pagination metadata.
*/
public CursorCollectionResult(final List<T> elements, CursorPagination pagination)
{
super(elements, null, pagination);
}
}
Loading