openapi_github/models/
markdown_render_request.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct MarkdownRenderRequest {
16    /// The Markdown text to render in HTML.
17    #[serde(rename = "text")]
18    pub text: String,
19    /// The rendering mode.
20    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
21    pub mode: Option<Mode>,
22    /// The repository context to use when creating references in `gfm` mode.  For example, setting `context` to `octo-org/octo-repo` will change the text `#42` into an HTML link to issue 42 in the `octo-org/octo-repo` repository.
23    #[serde(rename = "context", skip_serializing_if = "Option::is_none")]
24    pub context: Option<String>,
25}
26
27impl MarkdownRenderRequest {
28    pub fn new(text: String) -> MarkdownRenderRequest {
29        MarkdownRenderRequest {
30            text,
31            mode: None,
32            context: None,
33        }
34    }
35}
36/// The rendering mode.
37#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
38pub enum Mode {
39    #[serde(rename = "markdown")]
40    Markdown,
41    #[serde(rename = "gfm")]
42    Gfm,
43}
44
45impl Default for Mode {
46    fn default() -> Mode {
47        Self::Markdown
48    }
49}
50