pagination.proto 953 B

12345678910111213141516171819202122232425262728
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. // Offset-based page request for list RPCs whose result order is stable enough
  5. // for simple list browsing. Pages are live reads, not a fixed snapshot. Changes
  6. // between requests can shift offsets.
  7. message PageRequest {
  8. // Maximum number of items to request. Each RPC defines its default and
  9. // effective maximum. Valid values above that maximum are capped. This shared
  10. // shape rejects values above 500 or below zero. Zero uses the RPC default.
  11. int32 limit = 1 [(buf.validate.field).int32 = {
  12. gte: 0,
  13. lte: 500
  14. }];
  15. // Zero-based number of matching items to skip.
  16. int32 offset = 2 [(buf.validate.field).int32.gte = 0];
  17. }
  18. // Offset-based page metadata returned by list RPCs.
  19. message PageInfo {
  20. // Total matching item count before pagination.
  21. int64 total_count = 1;
  22. // True when another page exists after this response.
  23. bool has_more = 2;
  24. }