Skip to content

Commit c2b8f56

Browse files
committed
Change PaginationParams to make page_size and page_token mutually exclusive
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 1c485e4 commit c2b8f56

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
## Summary
44

5-
This release adds a new component category `COMPONENT_CATEGORY_HVAC` to the API.
5+
Update of the `PaginationParams` struct.
66

7-
## New Features
7+
## Upgrading
8+
9+
- `PaginationParams` has been changed so that the `page_size` and `page_token`
10+
fields are now mutually exclusive.
811

912
- A new component category `COMPONENT_CATEGORY_HVAC` has been added to the API
1013
to represent HVAC (Heating, Ventilation, and Air Conditioning) systems.

proto/frequenz/api/common/v1/pagination/pagination_params.proto

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ package frequenz.api.common.v1.pagination;
1111

1212
// A message defining parameters for paginating list requests.
1313
// It can be appended to a request message to specify the desired page of
14-
// results and the maximum number of results per page. For initial requests
15-
// (requesting the first page), the page_token should not be provided. For
16-
// subsequent requests (requesting any page after the first), the
17-
// next_page_token from the previous responses PaginationInfo must be supplied.
18-
// The page_size should only be specified in the initial request and will be
19-
// disregarded in subsequent requests.
14+
// results and the maximum number of results per page.
2015
message PaginationParams {
21-
// The maximum number of results to be returned per request.
22-
optional uint32 page_size = 1;
16+
oneof params {
17+
// The maximum number of results to return in a single page. The service may
18+
// return fewer results than requested. If unspecified, the service may
19+
// choose a reasonable default.
20+
// May only be specified in the first request.
21+
uint32 page_size = 1;
2322

24-
// The token identifying a specific page of the list results.
25-
optional string page_token = 2;
23+
// A token identifying a page of results to return. This should be the value
24+
// of the `next_page_token` field in the previous response's PaginationInfo.
25+
// For the first request, this field should be omitted.
26+
//
27+
// To avoid keeping remembering the page_size across requests, service
28+
// implementations may choose to encode the page_size in the page_token.
29+
string page_token = 2;
30+
}
2631
}

0 commit comments

Comments
 (0)