readme_api/
model.rs

1use serde::{Serialize, Deserialize};
2#[derive(Debug, Serialize, Deserialize)]
3pub struct Changelog {
4    #[serde(rename = "body")]
5    ///Body content of the changelog
6    pub body: String,
7    #[serde(rename = "hidden")]
8    ///Visibility of the changelog
9    pub hidden: Option<bool>,
10    #[serde(rename = "title")]
11    ///Title of the changelog
12    pub title: String,
13    #[serde(rename = "type")]
14    pub type_: Option<String>,
15}
16impl std::fmt::Display for Changelog {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
18        write!(f, "{}", serde_json::to_string(self).unwrap())
19    }
20}
21#[derive(Debug, Serialize, Deserialize)]
22pub struct CustomPage {
23    #[serde(rename = "body")]
24    ///Body formatted in Markdown (displayed by default).
25    pub body: Option<String>,
26    #[serde(rename = "hidden")]
27    ///Visibility of the custom page
28    pub hidden: Option<bool>,
29    #[serde(rename = "html")]
30    ///Body formatted in HTML (sanitized, only displayed if `htmlmode` is **true**).
31    pub html: Option<String>,
32    #[serde(rename = "htmlmode")]
33    ///**true** if `html` should be displayed, **false** if `body` should be displayed.
34    pub htmlmode: Option<bool>,
35    #[serde(rename = "title")]
36    ///Title of the custom page
37    pub title: String,
38}
39impl std::fmt::Display for CustomPage {
40    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
41        write!(f, "{}", serde_json::to_string(self).unwrap())
42    }
43}
44#[derive(Debug, Serialize, Deserialize)]
45pub struct Doc {
46    #[serde(rename = "body")]
47    ///Body content of the page, formatted in ReadMe or Github flavored Markdown. Accepts long page content, for example, greater than 100k characters
48    pub body: Option<String>,
49    #[serde(rename = "category")]
50    ///Category ID of the page, which you can get through https://docs.readme.com/developers/reference/categories#getcategory
51    pub category: String,
52    #[serde(rename = "hidden")]
53    ///Visibility of the page
54    pub hidden: Option<bool>,
55    #[serde(rename = "parentDoc")]
56    ///For a subpage, specify the parent doc ID, which you can get through https://docs.readme.com/developers/reference/docs#getdoc
57    pub parent_doc: Option<String>,
58    #[serde(rename = "title")]
59    ///Title of the page
60    pub title: String,
61    #[serde(rename = "type")]
62    ///Type of the page. The available types all show up under the /docs/ URL path of your docs project (also known as the "guides" section). Can be "basic" (most common), "error" (page desribing an API error), or "link" (page that redirects to an external link)
63    pub type_: Option<String>,
64}
65impl std::fmt::Display for Doc {
66    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
67        write!(f, "{}", serde_json::to_string(self).unwrap())
68    }
69}
70#[derive(Debug, Serialize, Deserialize)]
71pub struct Version {
72    #[serde(rename = "codename")]
73    ///Dubbed name of version
74    pub codename: Option<String>,
75    #[serde(rename = "from")]
76    ///Semantic Version to use as the base fork
77    pub from: String,
78    #[serde(rename = "is_beta")]
79    pub is_beta: Option<bool>,
80    #[serde(rename = "is_deprecated")]
81    ///Should this be deprecated? Only allowed in PUT operations
82    pub is_deprecated: Option<bool>,
83    #[serde(rename = "is_hidden")]
84    ///Should this be publically accessible?
85    pub is_hidden: Option<bool>,
86    #[serde(rename = "is_stable")]
87    ///Should this be the **main** version
88    pub is_stable: Option<bool>,
89    #[serde(rename = "version")]
90    ///Semantic Version
91    pub version: String,
92}
93impl std::fmt::Display for Version {
94    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
95        write!(f, "{}", serde_json::to_string(self).unwrap())
96    }
97}