Skip to main content

uapi_sdk_rust/models/generated/
post_text_markdown_to_html_request.rs

1/*
2 * UAPI
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0.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 PostTextMarkdownToHtmlRequest {
16    /// 原始 Markdown 字符串,最大不超过 1MB。
17    #[serde(rename = "text")]
18    pub text: String,
19    /// 响应格式。传 `json` 时返回 JSON 包裹的 HTML 片段;传 `html` 时直接返回 `text/html`,并且响应内容会自动带完整的网页结构,适合浏览器预览或直接保存为网页文件。默认是 `json`。
20    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
21    pub format: Option<Format>,
22    /// 是否开启安全模式,过滤掉用户输入中的风险脚本。默认是 `true`。
23    #[serde(rename = "sanitize", skip_serializing_if = "Option::is_none")]
24    pub sanitize: Option<bool>,
25}
26
27impl PostTextMarkdownToHtmlRequest {
28    pub fn new(text: String) -> PostTextMarkdownToHtmlRequest {
29        PostTextMarkdownToHtmlRequest {
30            text,
31            format: None,
32            sanitize: None,
33        }
34    }
35}
36/// 响应格式。传 `json` 时返回 JSON 包裹的 HTML 片段;传 `html` 时直接返回 `text/html`,并且响应内容会自动带完整的网页结构,适合浏览器预览或直接保存为网页文件。默认是 `json`。
37#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
38pub enum Format {
39    #[serde(rename = "json")]
40    Json,
41    #[serde(rename = "html")]
42    Html,
43}
44
45impl Default for Format {
46    fn default() -> Format {
47        Self::Json
48    }
49}
50