Skip to content

Commit bfea65c

Browse files
committed
API changes to support pagination in ListPayments.
1 parent 81bbcd0 commit bfea65c

2 files changed

Lines changed: 49 additions & 2 deletions

File tree

ldk-server-protos/src/api.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,16 @@ pub struct GetPaymentDetailsResponse {
331331
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.list_payments>
332332
#[allow(clippy::derive_partial_eq_without_eq)]
333333
#[derive(Clone, PartialEq, ::prost::Message)]
334-
pub struct ListPaymentsRequest {}
334+
pub struct ListPaymentsRequest {
335+
/// `page_token` is a pagination token.
336+
///
337+
/// To query for the first page, `page_token` must not be specified.
338+
///
339+
/// For subsequent pages, use the value that was returned as `next_page_token` in the previous
340+
/// page's response.
341+
#[prost(message, optional, tag = "1")]
342+
pub page_token: ::core::option::Option<super::types::PageToken>,
343+
}
335344
/// The response `content` for the `ListPayments` API, when HttpStatusCode is OK (200).
336345
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
337346
#[allow(clippy::derive_partial_eq_without_eq)]
@@ -340,6 +349,21 @@ pub struct ListPaymentsResponse {
340349
/// List of payments.
341350
#[prost(message, repeated, tag = "1")]
342351
pub payments: ::prost::alloc::vec::Vec<super::types::Payment>,
352+
/// `next_page_token` is a pagination token, used to retrieve the next page of results.
353+
/// Use this value to query for next-page of paginated operation, by specifying
354+
/// this value as the `page_token` in the next request.
355+
///
356+
/// If `next_page_token` is `None`, then the "last page" of results has been processed and
357+
/// there is no more data to be retrieved.
358+
///
359+
/// If `next_page_token` is not `None`, it does not necessarily mean that there is more data in the
360+
/// result set. The only way to know when you have reached the end of the result set is when
361+
/// `next_page_token` is `None`.
362+
///
363+
/// **Caution**: Clients must not assume a specific number of records to be present in a page for
364+
/// paginated response.
365+
#[prost(message, optional, tag = "2")]
366+
pub next_page_token: ::core::option::Option<super::types::PageToken>,
343367
}
344368
/// Retrieves list of all forwarded payments.
345369
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/enum.Event.html#variant.PaymentForwarded>

ldk-server-protos/src/proto/api.proto

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,36 @@ message GetPaymentDetailsResponse {
314314

315315
// Retrieves list of all payments.
316316
// See more: https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.list_payments
317-
message ListPaymentsRequest {}
317+
message ListPaymentsRequest {
318+
// `page_token` is a pagination token.
319+
//
320+
// To query for the first page, `page_token` must not be specified.
321+
//
322+
// For subsequent pages, use the value that was returned as `next_page_token` in the previous
323+
// page's response.
324+
optional types.PageToken page_token = 1;
325+
}
318326

319327
// The response `content` for the `ListPayments` API, when HttpStatusCode is OK (200).
320328
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
321329
message ListPaymentsResponse {
322330
// List of payments.
323331
repeated types.Payment payments = 1;
332+
333+
// `next_page_token` is a pagination token, used to retrieve the next page of results.
334+
// Use this value to query for next-page of paginated operation, by specifying
335+
// this value as the `page_token` in the next request.
336+
//
337+
// If `next_page_token` is `None`, then the "last page" of results has been processed and
338+
// there is no more data to be retrieved.
339+
//
340+
// If `next_page_token` is not `None`, it does not necessarily mean that there is more data in the
341+
// result set. The only way to know when you have reached the end of the result set is when
342+
// `next_page_token` is `None`.
343+
//
344+
// **Caution**: Clients must not assume a specific number of records to be present in a page for
345+
// paginated response.
346+
optional types.PageToken next_page_token = 2;
324347
}
325348

326349
// Retrieves list of all forwarded payments.

0 commit comments

Comments
 (0)