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 super::IcDashboardRequest;
8
9use serde::Serialize;
10
11///
12/// IcNodeProviderRewardListQuery
13///
14/// One explicitly bounded official Dashboard node-provider reward page query.
15///
16
17#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
18pub struct IcNodeProviderRewardListQuery {
19 /// Maximum reward rows requested from the API.
20 pub limit: u16,
21 /// Zero-based reward-row offset.
22 pub offset: u64,
23 /// Optional reward-index ceiling returned by an earlier page.
24 pub max_reward_index: Option<u64>,
25}
26
27impl IcNodeProviderRewardListQuery {
28 /// Construct one bounded node-provider reward page query.
29 #[must_use]
30 pub const fn new(limit: u16, offset: u64, max_reward_index: Option<u64>) -> Self {
31 Self {
32 limit,
33 offset,
34 max_reward_index,
35 }
36 }
37}
38
39///
40/// IcNodeProviderRewardListRequest
41///
42/// Request accepted by the bounded official Dashboard node-provider reward list builder.
43///
44
45#[derive(Clone, Debug, Eq, PartialEq)]
46pub struct IcNodeProviderRewardListRequest {
47 /// Explicit Dashboard endpoint and caller collection clock.
48 pub dashboard: IcDashboardRequest,
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 const fn new(dashboard: IcDashboardRequest, query: IcNodeProviderRewardListQuery) -> Self {
57 Self { dashboard, query }
58 }
59}
60
61///
62/// IcNodeProviderRewardInfoRequest
63///
64/// Request accepted by the exact official Dashboard node-provider reward builder.
65///
66
67#[derive(Clone, Debug, Eq, PartialEq)]
68pub struct IcNodeProviderRewardInfoRequest {
69 /// Explicit Dashboard endpoint and caller collection clock.
70 pub dashboard: IcDashboardRequest,
71 /// Exact Dashboard node-provider reward id.
72 pub reward_id: u64,
73}
74
75impl IcNodeProviderRewardInfoRequest {
76 /// Construct one exact live Dashboard node-provider reward request.
77 #[must_use]
78 pub const fn new(dashboard: IcDashboardRequest, reward_id: u64) -> Self {
79 Self {
80 dashboard,
81 reward_id,
82 }
83 }
84}
85
86///
87/// IcNodeProviderRewardHistoryQuery
88///
89/// One explicitly bounded official Dashboard node-provider reward history query.
90///
91
92#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
93pub struct IcNodeProviderRewardHistoryQuery {
94 /// Inclusive history start as Unix seconds.
95 pub start_unix_secs: u64,
96 /// Inclusive history end as Unix seconds.
97 pub end_unix_secs: u64,
98 /// Requested observation interval in seconds.
99 pub step_secs: u32,
100}
101
102impl IcNodeProviderRewardHistoryQuery {
103 /// Construct one explicit node-provider reward history window.
104 #[must_use]
105 pub const fn new(start_unix_secs: u64, end_unix_secs: u64, step_secs: u32) -> Self {
106 Self {
107 start_unix_secs,
108 end_unix_secs,
109 step_secs,
110 }
111 }
112}
113
114///
115/// IcNodeProviderRewardHistoryRequest
116///
117/// Request accepted by the bounded official Dashboard node-provider reward history builder.
118///
119
120#[derive(Clone, Debug, Eq, PartialEq)]
121pub struct IcNodeProviderRewardHistoryRequest {
122 /// Explicit Dashboard endpoint and caller collection clock.
123 pub dashboard: IcDashboardRequest,
124 /// Explicit history bounds.
125 pub query: IcNodeProviderRewardHistoryQuery,
126}
127
128impl IcNodeProviderRewardHistoryRequest {
129 /// Construct one bounded live Dashboard node-provider reward history request.
130 #[must_use]
131 pub const fn new(
132 dashboard: IcDashboardRequest,
133 query: IcNodeProviderRewardHistoryQuery,
134 ) -> Self {
135 Self { dashboard, query }
136 }
137}