1use crate::account::{Data, Status};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Serialize)]
5pub struct LoginArgs {
6 pub username: String,
7 pub password: String,
8}
9
10#[derive(Debug, Serialize)]
11pub struct LoginParams {
12 pub user: UserParam,
13}
14
15#[derive(Debug, Serialize)]
16pub struct UserParam {
17 pub email: String,
18 pub password: String,
19}
20
21#[derive(Debug, Serialize, Deserialize)]
22pub struct LoginResult {
23 pub status: Status,
24 pub data: Data,
25}
26
27#[cfg(test)]
28mod tests {
29 use super::*;
30 use serde_json::json;
31 #[test]
32 fn test_login() {
33 let args = LoginArgs {
34 username: "test".to_owned(),
35 password: "test".to_owned(),
36 };
37 let json = json!({
38 "username": "test",
39 "password": "test",
40 });
41 assert_eq!(serde_json::to_value(args).unwrap(), json);
42 }
43}