zsgf-client 1.0.24

zsgf 客户端库。
Documentation
/*
 * 全部  API 文档
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct GrantRequest {
    /// 返回地址。默认无限制,也可在【安全-开放认证网址白名单】配置
    #[serde(rename = "redirect_uri", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub redirect_uri: Option<Option<String>>,
    /// 授权类型。可选:email、phone、unionid、account
    #[serde(rename = "grant_type")]
    pub grant_type: String,
    /// 自定义授权范围,用英文空格分隔
    #[serde(rename = "scopes")]
    pub scopes: String,
    /// 用户名。授权类型为:email/phone/account必填
    #[serde(rename = "userName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub user_name: Option<Option<String>>,
    /// 登录密码。授权类型为:email/phone/account必填
    #[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub password: Option<Option<String>>,
    /// unionId。授权类型为:unionid必填
    #[serde(rename = "unionId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub union_id: Option<Option<String>>,
    /// 平台。授权类型为:unionid必填
    #[serde(rename = "platform", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub platform: Option<Option<String>>,
    /// 授权有效期。1~99天
    #[serde(rename = "expireInDays", skip_serializing_if = "Option::is_none")]
    pub expire_in_days: Option<i32>,
}

impl GrantRequest {
    pub fn new(grant_type: String, scopes: String) -> GrantRequest {
        GrantRequest {
            redirect_uri: None,
            grant_type,
            scopes,
            user_name: None,
            password: None,
            union_id: None,
            platform: None,
            expire_in_days: None,
        }
    }
}