nym_api_requests/models/
mod.rs1#![allow(deprecated)]
5
6use schemars::JsonSchema;
7use serde::{Deserialize, Serialize};
8use std::fmt;
9use std::fmt::{Display, Formatter};
10
11pub mod api_status;
12pub mod circulating_supply;
13pub mod described;
14pub mod legacy;
15pub mod mixnet;
16pub mod network;
17pub mod network_monitor;
18pub mod node_families;
19pub mod node_status;
20pub mod schema_helpers;
21pub mod utility;
22
23pub use api_status::*;
25pub use circulating_supply::*;
26pub use described::*;
27pub use legacy::*;
28pub use mixnet::*;
29pub use network::*;
30pub use network_monitor::*;
31pub use node_status::*;
32pub use schema_helpers::*;
33
34pub use nym_mixnet_contract_common::{EpochId, KeyRotationId, KeyRotationState};
35pub use nym_node_requests::api::v1::node::models::BinaryBuildInformationOwned;
36pub use nym_noise_keys::VersionedNoiseKeyV1;
37
38#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
39pub struct RequestError {
40 message: String,
41}
42
43impl RequestError {
44 pub fn new<S: Into<String>>(msg: S) -> Self {
45 RequestError {
46 message: msg.into(),
47 }
48 }
49
50 pub fn message(&self) -> &str {
51 &self.message
52 }
53
54 pub fn empty() -> Self {
55 Self {
56 message: String::new(),
57 }
58 }
59}
60
61impl Display for RequestError {
62 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
63 Display::fmt(&self.message, f)
64 }
65}