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_status;
19pub mod schema_helpers;
20
21pub use api_status::*;
23pub use circulating_supply::*;
24pub use described::*;
25pub use legacy::*;
26pub use mixnet::*;
27pub use network::*;
28pub use network_monitor::*;
29pub use node_status::*;
30pub use schema_helpers::*;
31
32pub use nym_mixnet_contract_common::{EpochId, KeyRotationId, KeyRotationState};
33pub use nym_node_requests::api::v1::node::models::BinaryBuildInformationOwned;
34pub use nym_noise_keys::VersionedNoiseKey;
35
36#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
37pub struct RequestError {
38 message: String,
39}
40
41impl RequestError {
42 pub fn new<S: Into<String>>(msg: S) -> Self {
43 RequestError {
44 message: msg.into(),
45 }
46 }
47
48 pub fn message(&self) -> &str {
49 &self.message
50 }
51
52 pub fn empty() -> Self {
53 Self {
54 message: String::new(),
55 }
56 }
57}
58
59impl Display for RequestError {
60 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
61 Display::fmt(&self.message, f)
62 }
63}