Skip to content

Commit 4f2c5e6

Browse files
committed
lib.rs documenation
1 parent eaf16a9 commit 4f2c5e6

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/lib.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,41 @@ pub mod ledgers;
307307
///
308308
pub mod effects;
309309

310+
/// Provides `Request` and `Response` structs for retrieving operations.
311+
///
312+
/// The `operations` module in the Stellar Horizon SDK includes structures and methods that facilitate
313+
/// querying operation data from the Horizon server.
314+
///
315+
/// # Usage
316+
///
317+
/// This module is used to construct requests for operation-related data and to parse the responses
318+
/// received from the Horizon server. It includes request and response structures for both
319+
/// individual operation queries and queries for a collection of operations.
320+
///
321+
/// # Example
322+
///
323+
/// To use this module, you can create an instance of a request struct, such as `SingleOperationRequest`
324+
/// or `AllOperationsRequest`, set any desired query parameters, and pass the request to the
325+
/// `HorizonClient`. The client will then execute the request and return the corresponding
326+
/// response struct, like `SingleOperationResponse` or `AllOperationsResponse`.
327+
///
328+
/// ```rust
329+
/// use stellar_rs::horizon_client::HorizonClient;
330+
/// use stellar_rs::operations::prelude::*;
331+
/// use stellar_rs::models::Request;
332+
///
333+
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
334+
/// let horizon_client = HorizonClient::new("https://horizon-testnet.stellar.org".to_string())?;
335+
///
336+
/// // Example: Fetching all operations
337+
/// let all_operations_request = AllOperationsRequest::new().set_limit(10)?;
338+
/// let operations_response = horizon_client.get_all_operations(&all_operations_request).await?;
339+
///
340+
/// // Process the responses...
341+
/// # Ok(())
342+
/// # }
343+
/// ```
344+
///
310345
pub mod operations;
311346

312347
/// Provides `Request` and `Response` structs for retrieving fee stats.
@@ -345,8 +380,6 @@ pub mod operations;
345380
///
346381
pub mod fee_stats;
347382

348-
pub mod operations;
349-
350383
/// Contains core data structures and traits.
351384
///
352385
/// This module is used by the Stellar Rust SDK to interact with the Horizon API.

0 commit comments

Comments
 (0)