uapi-sdk-rust 0.1.17

UAPI Rust SDK - idiomatic, typed, domain-driven API client.
Documentation
/*
 * UAPI
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PostTextMarkdownToHtmlRequest {
    /// 原始 Markdown 字符串,最大不超过 1MB。
    #[serde(rename = "text")]
    pub text: String,
    /// 响应格式。传 `json` 时返回 JSON 包裹的 HTML 片段;传 `html` 时直接返回 `text/html`,并且响应内容会自动带完整的网页结构,适合浏览器预览或直接保存为网页文件。默认是 `json`。
    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
    pub format: Option<Format>,
    /// 是否开启安全模式,过滤掉用户输入中的风险脚本。默认是 `true`。
    #[serde(rename = "sanitize", skip_serializing_if = "Option::is_none")]
    pub sanitize: Option<bool>,
}

impl PostTextMarkdownToHtmlRequest {
    pub fn new(text: String) -> PostTextMarkdownToHtmlRequest {
        PostTextMarkdownToHtmlRequest {
            text,
            format: None,
            sanitize: None,
        }
    }
}
/// 响应格式。传 `json` 时返回 JSON 包裹的 HTML 片段;传 `html` 时直接返回 `text/html`,并且响应内容会自动带完整的网页结构,适合浏览器预览或直接保存为网页文件。默认是 `json`。
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Format {
    #[serde(rename = "json")]
    Json,
    #[serde(rename = "html")]
    Html,
}

impl Default for Format {
    fn default() -> Format {
        Self::Json
    }
}