1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
mod models;

#[allow(unused_imports)]
pub use models::*;

pub mod webhooks;

#[cfg(feature = "pagination")]
mod pagination;

#[cfg(feature = "pagination")]
pub use pagination::*;
use serde::{Deserialize, Serialize};

/// Predefined types
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum StringOrInteger {
  String(String),
  Number(i64),
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum StringOrNumber {
  String(String),
  Number(f64),
}

/// Predefined types
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum ObjectOrString<T> {
  String(String),
  Object(T),
}

/// Predefined types
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum StringOrBool {
  String(String),
  Bool(bool),
}

/// Predefined types
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ReadWritePermission {
  #[serde(rename = "read")]
  Read,
  #[serde(rename = "write")]
  Write,
}

/// Predefined types
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ReadPermission {
  #[serde(rename = "read")]
  Read,
}

/// Predefined types
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum WritePermission {
  #[serde(rename = "write")]
  Write,
}

impl std::fmt::Display for StringOrNumber {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
    match self {
      StringOrNumber::String(x) => write!(f, "{}", x),
      StringOrNumber::Number(x) => write!(f, "{}", x),
    }
  }
}

impl std::fmt::Display for StringOrInteger {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
    match self {
      StringOrInteger::String(x) => write!(f, "{}", x),
      StringOrInteger::Number(x) => write!(f, "{}", x),
    }
  }
}

impl std::fmt::Display for StringOrBool {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
    match self {
      StringOrBool::String(x) => write!(f, "{}", x),
      StringOrBool::Bool(x) => write!(f, "{}", x),
    }
  }
}

impl std::fmt::Display for ReadWritePermission {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
    match self {
      ReadWritePermission::Read => write!(f, "read"),
      ReadWritePermission::Write => write!(f, "write"),
    }
  }
}

impl std::fmt::Display for ReadPermission {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
    match self {
      ReadPermission::Read => write!(f, "read"),
    }
  }
}

impl std::fmt::Display for WritePermission {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
    match self {
      WritePermission::Write => write!(f, "write"),
    }
  }
}