Skip to main content

ic_query/ic/model/requests/
replica_versions.rs

1//! Module: ic::model::requests::replica_versions
2//!
3//! Responsibility: bounded official Dashboard replica-version request contracts.
4//! Does not own: transport, returned release records, validation, or rendering.
5//! Boundary: captures one explicit page or one exact replica-version target.
6
7use serde::Serialize;
8
9///
10/// IcReplicaVersionListQuery
11///
12/// One explicitly bounded official Dashboard replica-version page query.
13///
14
15#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
16pub struct IcReplicaVersionListQuery {
17    /// Maximum release rows requested from the API.
18    pub limit: u16,
19    /// Zero-based release-row offset.
20    pub offset: u64,
21    /// Optional API proposal-index ceiling returned by an earlier page.
22    pub max_proposal_index: Option<u64>,
23}
24
25impl IcReplicaVersionListQuery {
26    /// Construct one bounded replica-version page query.
27    #[must_use]
28    pub const fn new(limit: u16, offset: u64, max_proposal_index: Option<u64>) -> Self {
29        Self {
30            limit,
31            offset,
32            max_proposal_index,
33        }
34    }
35}
36
37///
38/// IcReplicaVersionListRequest
39///
40/// Request accepted by the bounded official Dashboard replica-version list builder.
41///
42
43#[derive(Clone, Debug, Eq, PartialEq)]
44pub struct IcReplicaVersionListRequest {
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: IcReplicaVersionListQuery,
51}
52
53impl IcReplicaVersionListRequest {
54    /// Construct one bounded live Dashboard replica-version list request.
55    #[must_use]
56    pub fn new(
57        source_endpoint: impl Into<String>,
58        now_unix_secs: u64,
59        query: IcReplicaVersionListQuery,
60    ) -> Self {
61        Self {
62            source_endpoint: source_endpoint.into(),
63            now_unix_secs,
64            query,
65        }
66    }
67}
68
69///
70/// IcReplicaVersionInfoRequest
71///
72/// Request accepted by the exact official Dashboard replica-version builder.
73///
74
75#[derive(Clone, Debug, Eq, PartialEq)]
76pub struct IcReplicaVersionInfoRequest {
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 lowercase hexadecimal replica-version identifier.
82    pub replica_version_id: String,
83}
84
85impl IcReplicaVersionInfoRequest {
86    /// Construct one exact live Dashboard replica-version request.
87    #[must_use]
88    pub fn new(
89        source_endpoint: impl Into<String>,
90        now_unix_secs: u64,
91        replica_version_id: impl Into<String>,
92    ) -> Self {
93        Self {
94            source_endpoint: source_endpoint.into(),
95            now_unix_secs,
96            replica_version_id: replica_version_id.into(),
97        }
98    }
99}