diff --git a/stellar_rust_sdk/src/offers/all_offers_request.rs b/stellar_rust_sdk/src/offers/all_offers_request.rs index fdc3981..8d93330 100644 --- a/stellar_rust_sdk/src/offers/all_offers_request.rs +++ b/stellar_rust_sdk/src/offers/all_offers_request.rs @@ -35,23 +35,28 @@ use crate::Paginatable; /// #[derive(Default, Pagination)] pub struct AllOffersRequest { + /// Optional. The ID of the sponsor. When set, the response will + /// only include offers sponsored by the specified account. sponsor: Option, + /// Optional. The ID of the seller making the offer. When set, the response will + /// only include offers created by by the specified account. seller: Option, - + /// Optional. Indicates an selling asset for which offers are being queried. + /// When set, the response will filter the offers that hold this specific asset. // TODO: Make `NativeAsset` also possible selling: Option>, + /// Optional. Indicates a buying asset for which offers are being queried. + /// When set, the response will filter the offers that hold this specific asset. + // TODO: Make `NativeAsset` also possible buying: Option>, - /// 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. + /// `paging_token` value of a record. Used for pagination control in the API response. cursor: Option, - /// 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. + /// The range for this parameter is from 1 to 200. The default value is set to 10. limit: Option, - /// 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. + /// and [`Order::Desc`] (descending). If not specified, it defaults to ascending. order: Option, } @@ -80,10 +85,16 @@ impl Request for AllOffersRequest { } impl AllOffersRequest { + /// Creates a new `AllOffersRequest` with default parameters. pub fn new() -> Self { AllOffersRequest::default() } + /// Specifies the sponsor's public key in the request. + /// + /// # Arguments + /// * `sponsor` - A Stellar public key of the sponsor to filter offers by. + /// pub fn set_sponsor(self, sponsor: String) -> Result { if let Err(e) = is_public_key(&sponsor) { return Err(e.to_string()); @@ -95,6 +106,11 @@ impl AllOffersRequest { }) } + /// Specifies the seller's public key in the request. + /// + /// # Arguments + /// * `seller` - A Stellar public key of the seller to filter offers by. + /// pub fn set_seller(self, seller: String) -> Result { if let Err(e) = is_public_key(&seller) { return Err(e.to_string()); @@ -106,6 +122,11 @@ impl AllOffersRequest { }) } + /// Specifies the selling asset in the request. + /// + /// # Arguments + /// * `selling` - The selling asset to filter offers by. + /// pub fn set_selling(self, selling: Asset) -> AllOffersRequest { AllOffersRequest { selling: Some(selling), @@ -113,6 +134,11 @@ impl AllOffersRequest { } } + /// Specifies the buying asset in the request. + /// + /// # Arguments + /// * `buying` - The buying asset to filter offers by. + /// pub fn set_buying(self, buying: Asset) -> AllOffersRequest { AllOffersRequest { buying: Some(buying), diff --git a/stellar_rust_sdk/src/offers/response.rs b/stellar_rust_sdk/src/offers/response.rs index 9d41382..7d4834b 100644 --- a/stellar_rust_sdk/src/offers/response.rs +++ b/stellar_rust_sdk/src/offers/response.rs @@ -2,7 +2,11 @@ use crate::models::prelude::*; use derive_getters::Getters; use serde::{Deserialize, Serialize}; - +/// Represents the response for the 'all offers' query in the Horizon API. +/// +/// This struct defines the overall structure of the response for an 'all offers' query. +/// It includes navigational links and embedded results. +/// #[derive(Debug, Clone, Serialize, Deserialize, Getters)] #[serde(rename_all = "camelCase")] pub struct AllOffersResponse {