1use serde::{Serialize, Deserialize};
2#[derive(Debug, Serialize, Deserialize, Default)]
3pub struct Hub {
4 pub name: Option<String>,
6 pub description: Option<String>,
8 pub url: Option<String>,
10 pub created: Option<serde_json::Value>,
12 pub modified: Option<serde_json::Value>,
14 pub apis: Option<Vec<Api>>,
16}
17impl std::fmt::Display for Hub {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
19 write!(f, "{}", serde_json::to_string(self).unwrap())
20 }
21}
22#[derive(Debug, Serialize, Deserialize, Default)]
23pub struct Api {
24 pub id: Option<String>,
26 pub name: Option<String>,
28 pub description: Option<String>,
30 pub slug: Option<String>,
32 pub url: Option<String>,
34 pub version: Option<String>,
36 pub properties: Option<Vec<serde_json::Value>>,
38 pub created: Option<serde_json::Value>,
40 pub modified: Option<serde_json::Value>,
42}
43impl std::fmt::Display for Api {
44 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
45 write!(f, "{}", serde_json::to_string(self).unwrap())
46 }
47}
48#[derive(Debug, Serialize, Deserialize, Default)]
49pub struct Reference {
50 pub location: Option<String>,
52 pub content: Option<String>,
54}
55impl std::fmt::Display for Reference {
56 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
57 write!(f, "{}", serde_json::to_string(self).unwrap())
58 }
59}
60#[derive(Debug, Serialize, Deserialize, Default)]
61pub struct Error {
62 pub message: Option<String>,
64 pub errors: Option<serde_json::Value>,
66}
67impl std::fmt::Display for Error {
68 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
69 write!(f, "{}", serde_json::to_string(self).unwrap())
70 }
71}
72#[derive(Debug, Serialize, Deserialize, Default)]
73pub struct Pong {
74 pub pong: Option<String>,
76}
77impl std::fmt::Display for Pong {
78 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
79 write!(f, "{}", serde_json::to_string(self).unwrap())
80 }
81}
82#[derive(Debug, Serialize, Deserialize, Default)]
83pub struct Preview {
84 pub id: Option<String>,
86 pub expires_at: Option<String>,
88 pub public_url: Option<String>,
90}
91impl std::fmt::Display for Preview {
92 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
93 write!(f, "{}", serde_json::to_string(self).unwrap())
94 }
95}
96#[derive(Debug, Serialize, Deserialize, Default)]
97pub struct Version {
98 pub id: Option<String>,
100 pub doc_id: Option<String>,
102 pub doc_public_url: Option<String>,
104}
105impl std::fmt::Display for Version {
106 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
107 write!(f, "{}", serde_json::to_string(self).unwrap())
108 }
109}
110#[derive(Debug, Serialize, Deserialize, Default)]
111pub struct WithDiff {
112 pub diff_details: Option<Vec<DiffItem>>,
114 pub diff_markdown: Option<String>,
116 pub diff_summary: Option<String>,
118 pub diff_public_url: Option<String>,
120 pub diff_breaking: Option<bool>,
122}
123impl std::fmt::Display for WithDiff {
124 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
125 write!(f, "{}", serde_json::to_string(self).unwrap())
126 }
127}
128#[derive(Debug, Serialize, Deserialize, Default)]
129pub struct Diff {
130 pub id: Option<String>,
132 pub title: Option<String>,
134 pub public_url: Option<String>,
136 pub breaking: Option<bool>,
138 pub details: Option<Vec<DiffItem>>,
140 pub previous_version_url: Option<String>,
142 pub current_version_url: Option<String>,
144}
145impl std::fmt::Display for Diff {
146 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
147 write!(f, "{}", serde_json::to_string(self).unwrap())
148 }
149}
150#[derive(Debug, Serialize, Deserialize, Default)]
151pub struct DiffItem {
152 pub id: Option<String>,
154 pub name: Option<String>,
156 pub status: Option<String>,
157 #[serde(rename = "type")]
158 pub type_: Option<String>,
160 pub breaking: Option<bool>,
162 pub children: Option<Vec<DiffItem>>,
164}
165impl std::fmt::Display for DiffItem {
166 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
167 write!(f, "{}", serde_json::to_string(self).unwrap())
168 }
169}
170#[derive(Debug, Serialize, Deserialize)]
171pub struct DiffForApi(pub Diff, serde_json::Value);
172#[derive(Debug, Serialize, Deserialize, Default)]
173pub struct DocumentationRequest {
174 pub documentation: String,
176 pub hub: Option<String>,
178 pub documentation_name: Option<String>,
180 pub auto_create_documentation: Option<bool>,
182}
183impl std::fmt::Display for DocumentationRequest {
184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
185 write!(f, "{}", serde_json::to_string(self).unwrap())
186 }
187}
188#[derive(Debug, Serialize, Deserialize, Default)]
189pub struct Validation {
190 pub specification: Option<String>,
192}
193impl std::fmt::Display for Validation {
194 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
195 write!(f, "{}", serde_json::to_string(self).unwrap())
196 }
197}
198#[derive(Debug, Serialize, Deserialize, Default)]
199pub struct VersionRequest {
200 pub definition: String,
203 pub references: Option<Vec<Reference>>,
205 pub branch_name: Option<String>,
210}
211impl std::fmt::Display for VersionRequest {
212 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
213 write!(f, "{}", serde_json::to_string(self).unwrap())
214 }
215}
216#[derive(Debug, Serialize, Deserialize, Default)]
217pub struct PreviewRequest {
218 pub url: Option<String>,
222 pub definition: Option<String>,
227 pub references: Option<Vec<Reference>>,
229}
230impl std::fmt::Display for PreviewRequest {
231 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
232 write!(f, "{}", serde_json::to_string(self).unwrap())
233 }
234}
235#[derive(Debug, Serialize, Deserialize, Default)]
236pub struct DiffRequest {
237 pub url: Option<String>,
241 pub previous_url: Option<String>,
245 pub previous_definition: Option<String>,
250 pub previous_references: Option<Vec<Reference>>,
252 pub definition: Option<String>,
257 pub references: Option<Vec<Reference>>,
259 pub expires_at: Option<String>,
261}
262impl std::fmt::Display for DiffRequest {
263 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
264 write!(f, "{}", serde_json::to_string(self).unwrap())
265 }
266}