use crate::types::SecretString;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct CreateAccountParams {
pub account_id: String,
pub remark: Option<String>,
pub need_access_token: Option<bool>,
pub access_token_validity: Option<String>,
}
impl CreateAccountParams {
pub fn new(account_id: impl Into<String>) -> Self {
Self {
account_id: account_id.into(),
remark: None,
need_access_token: None,
access_token_validity: None,
}
}
pub fn with_remark(mut self, remark: impl Into<String>) -> Self {
self.remark = Some(remark.into());
self
}
pub fn with_need_access_token(mut self, need_access_token: bool) -> Self {
self.need_access_token = Some(need_access_token);
self
}
pub fn with_access_token_validity(mut self, validity: impl Into<String>) -> Self {
self.access_token_validity = Some(validity.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct GetAuthCodeParams {
pub account: String,
pub account_type: i32,
pub access_token_validity: Option<String>,
}
impl GetAuthCodeParams {
pub fn new(account: impl Into<String>, account_type: i32) -> Self {
Self {
account: account.into(),
account_type,
access_token_validity: None,
}
}
pub fn with_access_token_validity(mut self, validity: impl Into<String>) -> Self {
self.access_token_validity = Some(validity.into());
self
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct GetTokenParams {
pub auth_code: SecretString,
pub account: String,
pub account_type: i32,
}
impl GetTokenParams {
pub fn new(
auth_code: impl Into<String>,
account: impl Into<String>,
account_type: i32,
) -> Self {
Self {
auth_code: SecretString::new(auth_code),
account: account.into(),
account_type,
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct RefreshTokenParams {
pub refresh_token: SecretString,
}
impl RefreshTokenParams {
pub fn new(refresh_token: impl Into<String>) -> Self {
Self {
refresh_token: SecretString::new(refresh_token),
}
}
}