use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "export", derive(tsify::Tsify))]
#[cfg_attr(feature = "export", tsify(into_wasm_abi, from_wasm_abi))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RecentPlay {
pub beatmap_id: String, pub score: String, pub maxcombo: String, pub count50: String, pub count100: String, pub count300: String, pub countmiss: String, pub countkatu: String, pub countgeki: String, pub perfect: String, pub enabled_mods: String, pub user_id: String, pub date: String, pub rank: String, }
#[cfg_attr(feature = "export", derive(tsify::Tsify))]
#[cfg_attr(feature = "export", tsify(into_wasm_abi, from_wasm_abi))]
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GetUserRecentParamsRaw {
pub k: Option<String>, pub u: Option<String>, pub m: Option<u8>, pub limit: Option<u32>, pub t: Option<String>, }
#[cfg_attr(feature = "export", derive(tsify::Tsify))]
#[cfg_attr(feature = "export", tsify(into_wasm_abi, from_wasm_abi))]
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GetUserRecentParams {
pub api_key: Option<String>, pub user: Option<String>, pub mode: Option<u8>, pub limit: Option<u32>, pub typee: Option<String>, }
impl GetUserRecentParams {
pub fn api_key(mut self, api_key: String) -> Self {
self.api_key = Some(api_key);
self
}
pub fn user(mut self, user: String) -> Self {
self.user = Some(user);
self
}
pub fn mode(mut self, mode: u8) -> Self {
self.mode = Some(mode);
self
}
pub fn limit(mut self, limit: u32) -> Self {
self.limit = Some(limit);
self
}
pub fn typee(mut self, typee: String) -> Self {
self.typee = Some(typee);
self
}
pub fn build_params(&self) -> Vec<(String, String)> {
let mut params = Vec::new();
if let Some(ref api_key) = self.api_key {
params.push(("k".to_string(), api_key.clone()));
}
if let Some(ref user) = self.user {
params.push(("u".to_string(), user.clone()));
}
if let Some(ref mode) = self.mode {
params.push(("m".to_string(), mode.to_string()));
}
if let Some(ref limit) = self.limit {
params.push(("limit".to_string(), limit.to_string()));
}
if let Some(ref typee) = self.typee {
params.push(("type".to_string(), typee.clone()));
}
params
}
pub fn to_raw(&self) -> GetUserRecentParamsRaw {
GetUserRecentParamsRaw {
k: self.api_key.clone(),
u: self.user.clone(),
m: self.mode,
limit: self.limit,
t: self.typee.clone(),
}
}
}
impl GetUserRecentParamsRaw {
pub fn k(mut self, api_key: String) -> Self {
self.k = Some(api_key);
self
}
pub fn u(mut self, user: String) -> Self {
self.u = Some(user);
self
}
pub fn m(mut self, mode: u8) -> Self {
self.m = Some(mode);
self
}
pub fn limit(mut self, limit: u32) -> Self {
self.limit = Some(limit);
self
}
pub fn t(mut self, typee: String) -> Self {
self.t = Some(typee);
self
}
pub fn build_params(&self) -> Vec<(String, String)> {
let mut params = Vec::new();
if let Some(ref api_key) = self.k {
params.push(("k".to_string(), api_key.clone()));
}
if let Some(ref user) = self.u {
params.push(("u".to_string(), user.clone()));
}
if let Some(ref mode) = self.m {
params.push(("m".to_string(), mode.to_string()));
}
if let Some(ref limit) = self.limit {
params.push(("limit".to_string(), limit.to_string()));
}
if let Some(ref typee) = self.t {
params.push(("type".to_string(), typee.clone()));
}
params
}
}