diff --git a/src/accounts/accounts_request.rs b/src/accounts/accounts_request.rs index 46500a6..ccb8cf5 100644 --- a/src/accounts/accounts_request.rs +++ b/src/accounts/accounts_request.rs @@ -21,7 +21,7 @@ use crate::{models::*, BuildQueryParametersExt}; /// # let base_url = "https://horizon-testnet.stellar.org".to_string(); /// # let horizon_client = HorizonClient::new(base_url) /// # .expect("Failed to create Horizon Client"); -/// let request: AccountsRequest = AccountsRequest::new() +/// let request = AccountsRequest::new() /// .set_signer_filter("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7") /// .unwrap(); /// @@ -186,19 +186,6 @@ valid_account_request_impl!(AccountsRequest { /// Filter for accounts sponsored by the account ID or have a subentry @@ -377,6 +364,5 @@ mod tests { .set_sponsor_filter("sponsor".to_string()); assert!(request.is_err()); - // assert_eq!(request.unwrap_err(), "Public key must be 56 characters long"); } } diff --git a/src/accounts/mod.rs b/src/accounts/mod.rs index 604c398..61ddc77 100644 --- a/src/accounts/mod.rs +++ b/src/accounts/mod.rs @@ -5,26 +5,9 @@ /// is meant to be used with the [`HorizonClient::get_accounts_list`](crate::horizon_client::HorizonClient::get_account_list) /// method. /// -/// The detailed documentation and usage instructions for the `AccountsRequest` struct -/// can be found within the struct definition itself. -/// -/// # Usage -/// -/// Typically, an instance of `AccountsRequest` is created and potentially configured -/// with specific query parameters, before being passed to [`HorizonClient::get_accounts_list`](crate::horizon_client::HorizonClient::get_account_list). -/// For example, construct a request to filter by signer: -/// -/// ```rust -/// # use stellar_rust_sdk::accounts::accounts_request::AccountsRequest; -/// # use crate::stellar_rust_sdk::models::Request; -/// let mut request = AccountsRequest::new() -/// .set_signer_filter("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7").unwrap() -/// .set_limit(10).unwrap(); -/// // Use with HorizonClient::get_account_list -/// ``` -/// pub mod accounts_request; + /// Provides the `AccountsResponse`. /// /// This module provides a set of structures that represent the response received from the Horizon @@ -34,46 +17,11 @@ pub mod accounts_request; /// For a more elaborate overview of the returned values, please refer to the documentation of the /// List All Accounts endpoint. /// -/// Each structure is equipped with the necessary serialization and deserialization capabilities to handle -/// the JSON data returned by the Horizon server. Additionally, the `Getters` derive macro is used to -/// provide convenient getter methods for accessing the fields of these structures. -/// -/// # Usage -/// /// These structures are mainly used internally by the `HorizonClient` when processing responses from /// account-related API calls. The [`AccountsResponse`](crate::accounts::accounts_response::AccountsResponse) struct is of special importance here, /// as it is returned by the [`HorizonClient::get_accounts_list`](crate::horizon_client::HorizonClient::get_account_list) method, /// providing a user-friendly way to access account data. /// -/// # Example -/// -/// ``` -/// # use stellar_rust_sdk::accounts::prelude::{AccountsRequest, AccountsResponse}; -/// # use stellar_rust_sdk::models::*; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # -/// # async fn example() -> Result<(), Box> { -/// # let base_url = "https://horizon-testnet.stellar.org".to_string(); -/// # let horizon_client = HorizonClient::new(base_url) -/// # .expect("Failed to create Horizon Client"); -/// # -/// # let accounts_request = AccountsRequest::new() -/// # .set_signer_filter("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7").unwrap() -/// # .set_limit(10).unwrap(); -/// # -/// let accounts_response: Result = horizon_client -/// .get_account_list(&accounts_request) -/// .await; -/// -/// // Access the account details -/// for record in accounts_response?._embedded().records() { -/// println!("Account ID: {}", record.account_id()); -/// // Further processing... -/// } -/// # Ok({}) -/// # } -/// ``` -/// pub mod accounts_response; @@ -84,24 +32,9 @@ pub mod accounts_response; /// server. It is tailored for use with the [`HorizonClient::get_single_account`](crate::horizon_client::HorizonClient::get_single_account) /// method. /// -/// # Usage -/// -/// Create an instance of `SingleAccountRequest` and set the account ID to specify the -/// target account for the query. The struct can then be passed to the `get_single_account` -/// method of the `HorizonClient` to initiate the request. -/// -/// ``` -/// # use stellar_rust_sdk::accounts::prelude::SingleAccountRequest; -/// # use crate::stellar_rust_sdk::models::Request; -/// # -/// let mut single_account_request = SingleAccountRequest::new() -/// .set_account_id("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7".to_string()) -/// .unwrap(); -/// // Use with HorizonClient::get_single_account -/// ``` -/// pub mod single_account_request; + /// Provides the `SingleAccountResponse`. /// /// This module defines structures representing the response from the Horizon API when querying @@ -111,38 +44,6 @@ pub mod single_account_request; /// These structures are equipped with serialization capabilities to handle the JSON data from the /// Horizon server and with getter methods for easy field access. /// -/// # Usage -/// -/// Primarily used internally by the `HorizonClient` when handling responses from single account -/// queries. The [`SingleAccountResponse`](crate::accounts::single_account_response::SingleAccountResponse) struct, -/// specifically, is utilized to encapsulate and provide access to the details of the account being queried. -/// -/// # Example -/// -/// ``` -/// # use stellar_rust_sdk::accounts::prelude::{SingleAccountRequest, SingleAccountResponse}; -/// # use stellar_rust_sdk::models::*; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # -/// # async fn example() -> Result<(), Box> { -/// # let base_url = "https://horizon-testnet.stellar.org".to_string(); -/// # let horizon_client = HorizonClient::new(base_url) -/// # .expect("Failed to create Horizon Client"); -/// # -/// # let mut single_account_request = SingleAccountRequest::new() -/// # .set_account_id("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7".to_string()) -/// # .unwrap(); -/// # -/// let _single_account_response = horizon_client -/// .get_single_account(&single_account_request) -/// .await; -/// -/// // Access the account details -/// println!("Account ID: {}", _single_account_response?.account_id()); -/// # Ok({}) -/// # } -/// ``` -/// pub mod single_account_response; /// The base path for account-related endpoints in the Horizon API. diff --git a/src/assets/mod.rs b/src/assets/mod.rs index c9b1452..b65363d 100644 --- a/src/assets/mod.rs +++ b/src/assets/mod.rs @@ -8,30 +8,6 @@ /// to perform the actual API calls and fetch asset data. It adheres to the structure /// and requirements of the Horizon API for asset queries. /// -/// # Usage -/// -/// To use this module, create an instance of `AllAssetsRequest` and optionally set the desired -/// query parameters. Then, pass the request object to `HorizonClient::get_all_assets` method to -/// execute the query. The method returns an `AllAssetsResponse` containing the information about -/// the requested assets. -/// -/// # Example -/// ``` -/// # use stellar_rust_sdk::assets::all_assets_request::AllAssetsRequest; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Request; -/// # -/// # async fn fetch_assets() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// let request = AllAssetsRequest::new() -/// .set_asset_code("USD").unwrap(); // Example asset code -/// -/// let response = horizon_client.get_all_assets(&request).await?; -/// // Process the response -/// # Ok(()) -/// # } -/// ``` -/// pub mod all_assets_request; /// Provides the `AllAssetsResponse`. @@ -47,35 +23,6 @@ pub mod all_assets_request; /// with the JSON format of the Horizon server's response. They also leverage the `Getters` derive macro /// to furnish convenient getter methods for accessing their fields. /// -/// # Usage -/// -/// These response structures are predominantly used internally by the `HorizonClient` to parse responses -/// from asset-related API calls. The `AllAssetsResponse` struct, in particular, plays a crucial role, as it -/// is returned by the [`HorizonClient::get_all_assets`](crate::horizon_client::HorizonClient::get_all_assets) method, offering a user-friendly interface -/// to asset data. -/// -/// # Example -/// -/// ``` -/// # use stellar_rust_sdk::assets::prelude::{AllAssetsRequest, AllAssetsResponse}; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Response; -/// # -/// # async fn example() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// # let request = AllAssetsRequest::new() -/// # .set_asset_code("USD").unwrap(); // Example asset code -/// let all_assets_response: Result = horizon_client.get_all_assets(&request).await; -/// -/// // Access asset details -/// for asset in all_assets_response?._embedded().records() { -/// println!("Asset Code: {}", asset.asset_code()); -/// // Further processing... -/// } -/// # Ok(()) -/// # } -/// ``` -/// pub mod all_assets_response; /// The base path for all assets endpoints in the Stellar Horizon API. diff --git a/src/claimable_balances/mod.rs b/src/claimable_balances/mod.rs index ba379a3..c3f7818 100644 --- a/src/claimable_balances/mod.rs +++ b/src/claimable_balances/mod.rs @@ -9,31 +9,6 @@ /// to perform the actual API calls and fetch claimable balance data. It adheres to the structure /// and requirements of the Horizon API for claimable balance queries. /// -/// # Usage -/// -/// To use this module, create an instance of `AllClaimableBalancesRequest` and optionally set the desired -/// query parameters. Then, pass the request object to [`HorizonClient::get_all_claimable_balances`](crate::horizon_client::HorizonClient::get_all_claimable_balances) -/// method to execute the query. The method returns an `AllClaimableBalancesResponse` containing the information about -/// the requested assets. -/// -/// # Example -/// ``` -/// # use stellar_rust_sdk::claimable_balances::all_claimable_balances_request::AllClaimableBalancesRequest; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Request; -/// # -/// # async fn fetch_claimable_balances() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// let request = AllClaimableBalancesRequest::new() -/// .set_sponsor("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7".to_string()) -/// .unwrap(); -/// -/// let response = horizon_client.get_all_claimable_balances(&request).await?; -/// // Process the response -/// # Ok(()) -/// # } -/// ``` -/// pub mod all_claimable_balances_request; @@ -44,42 +19,6 @@ pub mod all_claimable_balances_request; /// Claimable balances are ledger entries that can be claimed by a designated account under /// certain conditions and are a unique feature of the Stellar network. /// -/// # Usage -/// -/// This module is typically used by the `HorizonClient` to deserialize the JSON response from -/// the Horizon server into a `AllClaimableBalancesResponse` object, which provides easy access -/// to the list of claimable balances and related information. -/// -/// # Example -/// ``` -/// # use stellar_rust_sdk::claimable_balances::prelude::*; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Response; -/// # -/// # async fn get_all_claimable_balances() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// # let request = AllClaimableBalancesRequest::new() -/// # .set_sponsor("GDQJUTQYK2MQX2VGDR2FYWLIYAQIEGXTQVTFEMGH2BEWFG4BRUY4CKI7".to_string()) -/// # .unwrap(); -/// # -/// let response: Result = horizon_client -/// .get_all_claimable_balances(&request) -/// .await; -/// -/// match response { -/// Ok(all_balances) => { -/// for balance in all_balances.embedded().records() { -/// println!("Balance ID: {}", balance.id()); -/// // Further processing... -/// } -/// }, -/// Err(e) => eprintln!("Error fetching claimable balances: {}", e), -/// } -/// # -/// # Ok(()) -/// # } -/// ``` -/// pub mod all_claimable_balances_response; /// Provides the `SingleClaimableBalanceRequest` struct. @@ -90,29 +29,7 @@ pub mod all_claimable_balances_response; /// /// The struct is intended to be used with the [`HorizonClient`](crate::horizon_client::HorizonClient) /// to perform API calls and fetch detailed information about a specific claimable balance. -/// -/// # Usage -/// -/// To use this module, instantiate a `SingleClaimableBalanceRequest` and set the claimable balance ID. -/// Then, pass this request to the [`HorizonClient::get_single_claimable_balance`](crate::horizon_client::HorizonClient::get_single_claimable_balance) method to execute the query. -/// The method returns a `SingleClaimableBalanceResponse` with the detailed information. -/// -/// # Example -/// ``` -/// # use stellar_rust_sdk::claimable_balances::single_claimable_balance_request::SingleClaimableBalanceRequest; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Request; -/// # -/// # async fn fetch_claimable_balance() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// let request = SingleClaimableBalanceRequest::new() -/// .set_claimable_balance_id("00000000".to_string()); // Example claimable balance ID -/// -/// let response = horizon_client.get_single_claimable_balance(&request).await?; -/// // Process the response -/// # Ok(()) -/// # } -/// ``` + /// pub mod single_claimable_balance_request; @@ -131,40 +48,6 @@ pub mod single_claimable_balance_request; /// JSON data returned by the Horizon server. The `Getters` derive macro is used to provide /// convenient getter methods for accessing fields of these structures. /// -/// # Usage -/// -/// The response structures are primarily used internally by the `HorizonClient` when processing -/// responses from claimable balance-related API calls. The `SingleClaimableBalanceResponse` struct -/// is especially important as it is returned by the -/// [`HorizonClient::get_single_claimable_balance`](crate::horizon_client::HorizonClient::get_single_claimable_balance) -/// method, providing a user-friendly way to access data of a single claimable balance. -/// -/// # Example -/// -/// ``` -/// # use stellar_rust_sdk::claimable_balances::prelude::{SingleClaimableBalanceRequest, SingleClaimableBalanceResponse}; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Response; -/// # -/// # async fn example() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// let claimable_balance_id = "123456789abcdefg".to_string(); -/// let request = SingleClaimableBalanceRequest::new() -/// .set_claimable_balance_id(claimable_balance_id); -/// -/// let response = horizon_client -/// .get_single_claimable_balance(&request) -/// .await; -/// -/// // Access the details of the claimable balance -/// if let Ok(balance_response) = response { -/// println!("Balance Amount: {}", balance_response.amount()); -/// // Further processing... -/// } -/// # Ok(()) -/// # } -/// ``` -/// pub mod single_claimable_balance_response; diff --git a/src/horizon_client.rs b/src/horizon_client.rs index 9ede76f..6b128d7 100644 --- a/src/horizon_client.rs +++ b/src/horizon_client.rs @@ -80,6 +80,13 @@ impl HorizonClient { /// let response: Result = horizon_client /// .get_account_list(&request) /// .await; + /// + /// // Access the account details + /// for record in response?._embedded().records() { + /// println!("Account ID: {}", record.account_id()); + /// // Further processing... + /// } + /// /// # Ok({}) /// # } pub async fn get_account_list( @@ -125,6 +132,9 @@ impl HorizonClient { /// .unwrap(); /// /// let response = horizon_client.get_single_account(&request).await; + /// + /// // Access the account details + /// println!("Account ID: {}", response?.account_id()); /// # Ok({}) /// # } /// ``` @@ -173,6 +183,12 @@ impl HorizonClient { /// .unwrap(); /// /// let response = horizon_client.get_all_assets(&request).await; + /// + /// // Access asset details + /// for asset in response?._embedded().records() { + /// println!("Asset Code: {}", asset.asset_code()); + /// // Further processing... + /// } /// # Ok({}) /// # } /// ``` @@ -219,6 +235,16 @@ impl HorizonClient { /// .unwrap(); /// /// let response = horizon_client.get_all_claimable_balances(&request).await; + /// + /// match response { + /// Ok(all_balances) => { + /// for balance in all_balances.embedded().records() { + /// println!("Balance ID: {}", balance.id()); + /// // Further processing... + /// } + /// }, + /// Err(e) => eprintln!("Error fetching claimable balances: {}", e), + /// } /// # Ok({}) /// # } /// ``` @@ -266,6 +292,13 @@ impl HorizonClient { /// .set_claimable_balance_id("000000006520216af66d20d63a58534d6cbdf28ba9f2a9c1e03f8d9a756bb7d988b29bca".to_string()); /// /// let response = horizon_client.get_single_claimable_balance(&request).await; + /// + /// // Access the details of the claimable balance + /// if let Ok(balance_response) = response { + /// println!("Balance Amount: {}", balance_response.amount()); + /// // Further processing... + /// } + /// /// # Ok({}) /// # } /// ``` @@ -314,6 +347,16 @@ impl HorizonClient { /// .unwrap(); /// /// let response = horizon_client.get_all_ledgers(&request).await; + /// // Process the response + /// match response { + /// Ok(ledgers_response) => { + /// for ledger in ledgers_response._embedded().records() { + /// println!("Ledger ID: {}", ledger.id()); + /// // Further processing... + /// } + /// } + /// Err(e) => println!("Error parsing response: {}", e), + /// } /// # Ok({}) /// # } /// ``` @@ -361,6 +404,11 @@ impl HorizonClient { /// .set_sequence(2).unwrap(); /// /// let response = horizon_client.get_single_ledger(&request).await; + /// + /// if let Ok(ledger) = response { + /// println!("Ledger ID: {}", ledger.id()); + /// // Additional processing... + /// } /// # Ok({}) /// # } /// ``` diff --git a/src/ledgers/mod.rs b/src/ledgers/mod.rs index df4ce34..85c2bd2 100644 --- a/src/ledgers/mod.rs +++ b/src/ledgers/mod.rs @@ -10,34 +10,6 @@ /// information about the ledgers in the Stellar network, including transactions, operations, /// and effects within each ledger. /// -/// # Usage -/// -/// To use this module, create an instance of `LedgersRequest` and set any desired pagination -/// options. Then, pass the request object to the appropriate method of `HorizonClient` -/// to execute the query. The client will return a response containing the ledger data. -/// -/// # Example -/// ```rust -/// use stellar_rust_sdk::horizon_client::HorizonClient; -/// use stellar_rust_sdk::ledgers::ledgers_request::LedgersRequest; -/// use stellar_rust_sdk::models::*; -/// -/// # async fn example() -> Result<(), Box> { -/// let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// -/// // Constructing a request to fetch ledgers -/// let ledgers_request = LedgersRequest::new() -/// .set_limit(10)? // Setting the number of ledgers to retrieve -/// .set_order(Order::Desc); // Setting the order of ledgers -/// -/// // Fetching the ledgers from Horizon -/// let ledgers_response = horizon_client.get_all_ledgers(&ledgers_request).await?; -/// -/// // Processing the response... -/// # Ok(()) -/// # } -/// ``` -/// pub mod ledgers_request; /// Provides the `LedgersResponse` struct. @@ -49,37 +21,6 @@ pub mod ledgers_request; /// The primary structure in this module is `LedgersResponse`, which contains detailed information about /// each ledger, including its transactions, operations, and other related data. /// -/// # Usage -/// The `LedgersResponse` and other related structures in this module are typically used internally by the -/// `HorizonClient` when handling responses from ledger-related API calls. However, they can also be used directly -/// in client applications for custom processing of ledger data. -/// -/// # Example -/// ```rust -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::ledgers::prelude::*; -/// # use stellar_rust_sdk::models::Request; -/// # -/// # async fn example() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// # -/// # let all_ledgers_request = LedgersRequest::new().set_limit(10)?; -/// let ledgers_response = horizon_client.get_all_ledgers(&all_ledgers_request).await; -/// -/// // Process the response -/// match ledgers_response { -/// Ok(response) => { -/// for ledger in response._embedded().records() { -/// println!("Ledger ID: {}", ledger.id()); -/// // Further processing... -/// } -/// } -/// Err(e) => println!("Error parsing response: {}", e), -/// } -/// # Ok(()) -/// # } -/// ``` -/// pub mod ledgers_response; /// Provides the `SingleLedgerRequest` struct. @@ -94,31 +35,6 @@ pub mod ledgers_response; /// allows users to fetch specific ledger details, such as transactions, operations, and more, /// based on the ledger sequence number. /// -/// # Usage -/// -/// To utilize this module, create an instance of `SingleLedgerRequest`, set the ledger sequence -/// number using the `set_sequence` method, and pass it to the `HorizonClient::get_single_ledger` -/// method. This method will return a `SingleLedgerResponse`, which contains the detailed -/// information of the specified ledger. -/// -/// # Example -/// -/// ``` -/// # use stellar_rust_sdk::ledgers::single_ledger_request::SingleLedgerRequest; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Request; -/// # -/// # async fn example() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// let ledger_sequence = 1234567; // Replace with the desired ledger sequence number -/// let request = SingleLedgerRequest::new().set_sequence(ledger_sequence)?; -/// -/// let ledger_response = horizon_client.get_single_ledger(&request).await?; -/// // Process the ledger response here -/// # Ok(()) -/// # } -/// ``` -/// pub mod single_ledger_request; /// Provides the `SingleLedgerResponse` structure. @@ -129,35 +45,7 @@ pub mod single_ledger_request; /// /// The `SingleLedgerResponse` struct is particularly useful for applications that need to access specific /// details about a single ledger, such as its transaction count, operation count, total coins, and so on. -/// -/// # Usage -/// -/// This structure is primarily used internally by the `HorizonClient` to process responses from -/// single ledger-related API calls. After making a request for a specific ledger using the -/// `SingleLedgerRequest`, the response from the Horizon server is deserialized into an instance of -/// `SingleLedgerResponse`. -/// -/// # Example -/// -/// Assuming you have already made a request using `SingleLedgerRequest` and have a valid `HorizonClient`: -/// ``` -/// # use stellar_rust_sdk::ledgers::single_ledger_request::{SingleLedgerRequest, Sequence}; -/// # use stellar_rust_sdk::ledgers::single_ledger_response::SingleLedgerResponse; -/// # use stellar_rust_sdk::horizon_client::HorizonClient; -/// # use stellar_rust_sdk::models::Request; -/// # -/// # async fn fetch_ledger_details() -> Result<(), Box> { -/// # let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?; -/// # let request = SingleLedgerRequest::new().set_sequence(123456)?; -/// let ledger_response: Result = horizon_client.get_single_ledger(&request).await; -/// -/// if let Ok(ledger) = ledger_response { -/// println!("Ledger ID: {}", ledger.id()); -/// // Additional processing... -/// } -/// # Ok(()) -/// # } -/// ``` + /// pub mod single_ledger_response; diff --git a/src/lib.rs b/src/lib.rs index 4721665..de85cac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -338,17 +338,18 @@ trait BuildQueryParametersExt { /// This method transforms the properties of the implementing object into a URL-encoded query /// string. /// + fn build_query_parameters(self) -> String; +} + +impl BuildQueryParametersExt> for Vec> { /// # Implementation for `Vec>` /// Converts each property to a key-value pair, and concatenates pairs with '&'. /// Properties that are `None` are omitted from the string. + /// /// ## Returns /// A `String` representing the query parameters of the HTTP request. If there /// are no parameters, or all properties are `None`, an empty string is returned. - fn build_query_parameters(self) -> String; -} - -impl BuildQueryParametersExt> for Vec> { - /// Constructs a query string from a vector of optional values. + /// fn build_query_parameters(self) -> String { let params = self.into_iter() // Iterate over each element in the vector.