Skip to content

Commit

Permalink
Add pagination macro and fields to request
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-pease authored and tluijken committed Aug 22, 2024
1 parent 06fcac0 commit d7441fe
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion stellar_rust_sdk/src/offers/offers_for_account_request.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::models::*;
use stellar_rust_sdk_derive::Pagination;
use crate::Paginatable;

/// Represents the ID of an account for which the offers are to be retrieved.
#[derive(Default, Clone)]
Expand All @@ -9,9 +11,19 @@ pub struct OfferAccountId(String);
pub struct NoOfferAccountId;
#[derive(Default)]

#[derive(Pagination)]
pub struct OffersForAccountRequest<I> {
/// The ID of the account for which the offers are to be retrieved.
account_id: I,
/// A pointer to a specific location in a collection of responses, derived from the
/// `paging_token` value of a record. Used for pagination control in the API response.
cursor: Option<u32>,
/// Specifies the maximum number of records to be returned in a single response.
/// The range for this parameter is from 1 to 200. The default value is set to 10.
limit: Option<u8>,
/// Determines the [`Order`] of the records in the response. Valid options are [`Order::Asc`] (ascending)
/// and [`Order::Desc`] (descending). If not specified, it defaults to ascending.
order: Option<Order>,
}

impl OffersForAccountRequest<NoOfferAccountId> {
Expand All @@ -29,7 +41,10 @@ impl OffersForAccountRequest<NoOfferAccountId> {
}

Ok(OffersForAccountRequest {
account_id: OfferAccountId(account_id,)
account_id: OfferAccountId(account_id,),
cursor: self.cursor,
limit: self.limit,
order: self.order,
})
}
}
Expand Down

0 comments on commit d7441fe

Please sign in to comment.