-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Problem
List endpoints return all results:
- Memory issues with large datasets
- Slow response times
- No cursor-based navigation
Proposed Solution
Cursor-Based Pagination
type PaginationParams struct {
Limit int // max 100, default 20
Cursor string // opaque cursor
}
type PaginatedResponse[T any] struct {
Items []T `json:"items"`
NextCursor string `json:"next_cursor,omitempty"`
HasMore bool `json:"has_more"`
Total int `json:"total,omitempty"`
}
// Cursor encoding
func EncodeCursor(id string, timestamp time.Time) string {
data := fmt.Sprintf("%s:%d", id, timestamp.UnixNano())
return base64.StdEncoding.EncodeToString([]byte(data))
}API Changes
GET /v1/tasks?limit=20&cursor=abc123
Response:
{
"items": [...],
"next_cursor": "def456",
"has_more": true,
"total": 150
}
Acceptance Criteria
- All list endpoints support pagination
- Default limit: 20, max: 100
- Cursor-based (not offset-based)
- Link headers for navigation
- Backward compatibility (no cursor = first page)
References
- Evaluation Report Section: 1.1 API Design Quality
Reactions are currently unavailable