File tree Expand file tree Collapse file tree 5 files changed +60
-16
lines changed Expand file tree Collapse file tree 5 files changed +60
-16
lines changed Original file line number Diff line number Diff line change 5959
6060- Updated the package name of ` location.proto ` to ` frequenz.api.common.v1 ` .
6161
62+ - Added messages to support pagination in APIs.
63+
6264## New Features
6365
6466<!-- Here goes the main new features and examples or instructions on how to use them -->
Original file line number Diff line number Diff line change @@ -9,22 +9,6 @@ syntax = "proto3";
99
1010package frequenz.api.common.v1.pagination ;
1111
12- // A message defining parameters for paginating list requests.
13- // 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.
20- message PaginationParams {
21- // The maximum number of results to be returned per request.
22- optional uint32 page_size = 1 ;
23-
24- // The token identifying a specific page of the list results.
25- optional string page_token = 2 ;
26- }
27-
2812// A message providing metadata about paginated list results.
2913// The PaginationInfo message delivers metadata concerning the paginated list
3014// results and should be appended to the response message of a list request. The
Original file line number Diff line number Diff line change 1+ // Parameters for pagination.
2+ //
3+ // Copyright 2023 Frequenz Energy-as-a-Service GmbH
4+ //
5+ // Licensed under the MIT License (the "License");
6+ // you may not use this file except in compliance with the License.
7+
8+ syntax = "proto3" ;
9+
10+ package frequenz.api.common.v1.pagination ;
11+
12+ // A message defining parameters for paginating list requests.
13+ // 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.
20+ message PaginationParams {
21+ // The maximum number of results to be returned per request.
22+ optional uint32 page_size = 1 ;
23+
24+ // The token identifying a specific page of the list results.
25+ optional string page_token = 2 ;
26+ }
Original file line number Diff line number Diff line change 1+ # License: MIT
2+ # Copyright © 2023 Frequenz Energy-as-a-Service GmbH
3+
4+ """Frequenz common gRPC API and bindings."""
Original file line number Diff line number Diff line change @@ -179,3 +179,31 @@ def test_module_import_location() -> None:
179179 from frequenz .api .common .v1 import location_pb2_grpc
180180
181181 assert location_pb2_grpc is not None
182+
183+
184+ def test_module_import_pagination () -> None :
185+ """Test that the modules can be imported."""
186+ # pylint: disable=import-outside-toplevel
187+ from frequenz .api .common .v1 import pagination
188+
189+ assert pagination is not None
190+
191+ # pylint: disable=import-outside-toplevel
192+ from frequenz .api .common .v1 .pagination import pagination_info_pb2
193+
194+ assert pagination_info_pb2 is not None
195+
196+ # pylint: disable=import-outside-toplevel
197+ from frequenz .api .common .v1 .pagination import pagination_info_pb2_grpc
198+
199+ assert pagination_info_pb2_grpc is not None
200+
201+ # pylint: disable=import-outside-toplevel
202+ from frequenz .api .common .v1 .pagination import pagination_params_pb2
203+
204+ assert pagination_params_pb2 is not None
205+
206+ # pylint: disable=import-outside-toplevel
207+ from frequenz .api .common .v1 .pagination import pagination_params_pb2_grpc
208+
209+ assert pagination_params_pb2_grpc is not None
You can’t perform that action at this time.
0 commit comments