// Parameters for pagination.
//
// Copyright 2023 Frequenz Energy-as-a-Service GmbH
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.

syntax = "proto3";

package frequenz.api.common.v1.pagination;

// A message defining parameters for paginating list requests.
// It can be appended to a request message to specify the desired page of
// results and the maximum number of results per page.
message PaginationParams {
  oneof params {
    // The maximum number of results to return in a single page. The service may
    // return fewer results than requested. If unspecified, the service may
    // choose a reasonable default.
    // May only be specified in the first request.
    uint32 page_size = 1;

    // A token identifying a page of results to return. This should be the value
    // of the `next_page_token` field in the previous response's PaginationInfo.
    // For the first request, this field should be omitted.
    //
    // To avoid keeping remembering the page_size across requests, service
    // implementations may choose to encode the page_size in the page_token.
    string page_token = 2;
  }
}
