nym_api_requests/
lib.rs

1// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
2// SPDX-License-Identifier: Apache-2.0
3
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6
7pub mod constants;
8pub mod ecash;
9mod helpers;
10pub mod models;
11pub mod nym_nodes;
12pub mod pagination;
13pub mod signable;
14
15// The response type we fetch from the network details endpoint.
16#[derive(Clone, Debug, Serialize, Deserialize)]
17pub struct NymNetworkDetailsResponse {
18    pub network: nym_config::defaults::NymNetworkDetails,
19}
20
21pub trait Deprecatable {
22    fn deprecate(self) -> Deprecated<Self>
23    where
24        Self: Sized,
25    {
26        self.into()
27    }
28}
29
30impl<T> Deprecatable for T {}
31
32#[derive(Serialize, Deserialize, JsonSchema)]
33pub struct Deprecated<T> {
34    pub deprecated: bool,
35    #[serde(flatten)]
36    pub response: T,
37}
38
39impl<T> From<T> for Deprecated<T> {
40    fn from(response: T) -> Self {
41        Deprecated {
42            deprecated: true,
43            response,
44        }
45    }
46}