ic_query/ic/model/requests/node_provider_rewards.rs
1//! Module: ic::model::requests::node_provider_rewards
2//!
3//! Responsibility: bounded official Dashboard node-provider reward request contracts.
4//! Does not own: transport, returned reward records, validation, or rendering.
5//! Boundary: captures one explicit page, one exact reward id, or one bounded history window.
6
7use serde::Serialize;
8
9///
10/// IcNodeProviderRewardListQuery
11///
12/// One explicitly bounded official Dashboard node-provider reward page query.
13///
14
15#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
16pub struct IcNodeProviderRewardListQuery {
17 /// Maximum reward rows requested from the API.
18 pub limit: u16,
19 /// Zero-based reward-row offset.
20 pub offset: u64,
21 /// Optional reward-index ceiling returned by an earlier page.
22 pub max_reward_index: Option<u64>,
23}
24
25impl IcNodeProviderRewardListQuery {
26 /// Construct one bounded node-provider reward page query.
27 #[must_use]
28 pub const fn new(limit: u16, offset: u64, max_reward_index: Option<u64>) -> Self {
29 Self {
30 limit,
31 offset,
32 max_reward_index,
33 }
34 }
35}
36
37///
38/// IcNodeProviderRewardListRequest
39///
40/// Request accepted by the bounded official Dashboard node-provider reward list builder.
41///
42
43#[derive(Clone, Debug, Eq, PartialEq)]
44pub struct IcNodeProviderRewardListRequest {
45 /// Dashboard API v3 base endpoint.
46 pub source_endpoint: String,
47 /// Collection time as Unix seconds.
48 pub now_unix_secs: u64,
49 /// Explicit page bounds.
50 pub query: IcNodeProviderRewardListQuery,
51}
52
53impl IcNodeProviderRewardListRequest {
54 /// Construct one bounded live Dashboard node-provider reward list request.
55 #[must_use]
56 pub fn new(
57 source_endpoint: impl Into<String>,
58 now_unix_secs: u64,
59 query: IcNodeProviderRewardListQuery,
60 ) -> Self {
61 Self {
62 source_endpoint: source_endpoint.into(),
63 now_unix_secs,
64 query,
65 }
66 }
67}
68
69///
70/// IcNodeProviderRewardInfoRequest
71///
72/// Request accepted by the exact official Dashboard node-provider reward builder.
73///
74
75#[derive(Clone, Debug, Eq, PartialEq)]
76pub struct IcNodeProviderRewardInfoRequest {
77 /// Dashboard API v3 base endpoint.
78 pub source_endpoint: String,
79 /// Collection time as Unix seconds.
80 pub now_unix_secs: u64,
81 /// Exact Dashboard node-provider reward id.
82 pub reward_id: u64,
83}
84
85impl IcNodeProviderRewardInfoRequest {
86 /// Construct one exact live Dashboard node-provider reward request.
87 #[must_use]
88 pub fn new(source_endpoint: impl Into<String>, now_unix_secs: u64, reward_id: u64) -> Self {
89 Self {
90 source_endpoint: source_endpoint.into(),
91 now_unix_secs,
92 reward_id,
93 }
94 }
95}
96
97///
98/// IcNodeProviderRewardHistoryQuery
99///
100/// One explicitly bounded official Dashboard node-provider reward history query.
101///
102
103#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
104pub struct IcNodeProviderRewardHistoryQuery {
105 /// Inclusive history start as Unix seconds.
106 pub start_unix_secs: u64,
107 /// Inclusive history end as Unix seconds.
108 pub end_unix_secs: u64,
109 /// Requested observation interval in seconds.
110 pub step_secs: u32,
111}
112
113impl IcNodeProviderRewardHistoryQuery {
114 /// Construct one explicit node-provider reward history window.
115 #[must_use]
116 pub const fn new(start_unix_secs: u64, end_unix_secs: u64, step_secs: u32) -> Self {
117 Self {
118 start_unix_secs,
119 end_unix_secs,
120 step_secs,
121 }
122 }
123}
124
125///
126/// IcNodeProviderRewardHistoryRequest
127///
128/// Request accepted by the bounded official Dashboard node-provider reward history builder.
129///
130
131#[derive(Clone, Debug, Eq, PartialEq)]
132pub struct IcNodeProviderRewardHistoryRequest {
133 /// Dashboard API v3 base endpoint.
134 pub source_endpoint: String,
135 /// Collection time as Unix seconds.
136 pub now_unix_secs: u64,
137 /// Explicit history bounds.
138 pub query: IcNodeProviderRewardHistoryQuery,
139}
140
141impl IcNodeProviderRewardHistoryRequest {
142 /// Construct one bounded live Dashboard node-provider reward history request.
143 #[must_use]
144 pub fn new(
145 source_endpoint: impl Into<String>,
146 now_unix_secs: u64,
147 query: IcNodeProviderRewardHistoryQuery,
148 ) -> Self {
149 Self {
150 source_endpoint: source_endpoint.into(),
151 now_unix_secs,
152 query,
153 }
154 }
155}