pub struct StakePoolStatsRequest {
pub bucket_type: Option<String>,
pub range_filter: Option<RangeFilter>,
pub sort_by: Option<SortBy>,
}Expand description
Request for stake pool statistics
Fields§
§bucket_type: Option<String>Time bucket aggregation type (currently only “Daily” is supported)
range_filter: Option<RangeFilter>Date range filter
sort_by: Option<SortBy>Sort configuration
Implementations§
Source§impl StakePoolStatsRequest
impl StakePoolStatsRequest
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new request with default values
Examples found in repository?
examples/stake_pool_stats.rs (line 20)
7async fn main() {
8 let client = KobeApiClientBuilder::new()
9 .timeout(Duration::from_secs(45))
10 .retry(true)
11 .max_retries(5)
12 .build();
13
14 let current_epoch = client.get_current_epoch().await.unwrap();
15 println!("Current epoch: {}\n", current_epoch);
16
17 let end = Utc::now();
18
19 let start = end - chrono::Duration::days(1);
20 let request = StakePoolStatsRequest::new()
21 .with_bucket_type("Daily")
22 .with_range_filter(start, end)
23 .sort_asc();
24
25 let stake_pool_stats = client.get_stake_pool_stats(Some(&request)).await.unwrap();
26
27 println!("Stake Pool Stats: {:?}", stake_pool_stats);
28}Sourcepub fn with_bucket_type(self, bucket_type: impl Into<String>) -> Self
pub fn with_bucket_type(self, bucket_type: impl Into<String>) -> Self
Set bucket type (currently only “Daily” is supported)
Examples found in repository?
examples/stake_pool_stats.rs (line 21)
7async fn main() {
8 let client = KobeApiClientBuilder::new()
9 .timeout(Duration::from_secs(45))
10 .retry(true)
11 .max_retries(5)
12 .build();
13
14 let current_epoch = client.get_current_epoch().await.unwrap();
15 println!("Current epoch: {}\n", current_epoch);
16
17 let end = Utc::now();
18
19 let start = end - chrono::Duration::days(1);
20 let request = StakePoolStatsRequest::new()
21 .with_bucket_type("Daily")
22 .with_range_filter(start, end)
23 .sort_asc();
24
25 let stake_pool_stats = client.get_stake_pool_stats(Some(&request)).await.unwrap();
26
27 println!("Stake Pool Stats: {:?}", stake_pool_stats);
28}Sourcepub fn with_range_filter(self, start: DateTime<Utc>, end: DateTime<Utc>) -> Self
pub fn with_range_filter(self, start: DateTime<Utc>, end: DateTime<Utc>) -> Self
Set range filter
Examples found in repository?
examples/stake_pool_stats.rs (line 22)
7async fn main() {
8 let client = KobeApiClientBuilder::new()
9 .timeout(Duration::from_secs(45))
10 .retry(true)
11 .max_retries(5)
12 .build();
13
14 let current_epoch = client.get_current_epoch().await.unwrap();
15 println!("Current epoch: {}\n", current_epoch);
16
17 let end = Utc::now();
18
19 let start = end - chrono::Duration::days(1);
20 let request = StakePoolStatsRequest::new()
21 .with_bucket_type("Daily")
22 .with_range_filter(start, end)
23 .sort_asc();
24
25 let stake_pool_stats = client.get_stake_pool_stats(Some(&request)).await.unwrap();
26
27 println!("Stake Pool Stats: {:?}", stake_pool_stats);
28}Sourcepub fn with_sort_by(
self,
field: impl Into<String>,
order: impl Into<String>,
) -> Self
pub fn with_sort_by( self, field: impl Into<String>, order: impl Into<String>, ) -> Self
Set sort configuration
Sourcepub fn sort_asc(self) -> Self
pub fn sort_asc(self) -> Self
Set sort order to ascending
Examples found in repository?
examples/stake_pool_stats.rs (line 23)
7async fn main() {
8 let client = KobeApiClientBuilder::new()
9 .timeout(Duration::from_secs(45))
10 .retry(true)
11 .max_retries(5)
12 .build();
13
14 let current_epoch = client.get_current_epoch().await.unwrap();
15 println!("Current epoch: {}\n", current_epoch);
16
17 let end = Utc::now();
18
19 let start = end - chrono::Duration::days(1);
20 let request = StakePoolStatsRequest::new()
21 .with_bucket_type("Daily")
22 .with_range_filter(start, end)
23 .sort_asc();
24
25 let stake_pool_stats = client.get_stake_pool_stats(Some(&request)).await.unwrap();
26
27 println!("Stake Pool Stats: {:?}", stake_pool_stats);
28}Trait Implementations§
Source§impl Clone for StakePoolStatsRequest
impl Clone for StakePoolStatsRequest
Source§fn clone(&self) -> StakePoolStatsRequest
fn clone(&self) -> StakePoolStatsRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StakePoolStatsRequest
impl Debug for StakePoolStatsRequest
Source§impl Default for StakePoolStatsRequest
impl Default for StakePoolStatsRequest
Source§fn default() -> StakePoolStatsRequest
fn default() -> StakePoolStatsRequest
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for StakePoolStatsRequest
impl<'de> Deserialize<'de> for StakePoolStatsRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StakePoolStatsRequest
impl RefUnwindSafe for StakePoolStatsRequest
impl Send for StakePoolStatsRequest
impl Sync for StakePoolStatsRequest
impl Unpin for StakePoolStatsRequest
impl UnwindSafe for StakePoolStatsRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more