feature/wasm
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | use crate::account::{Data, Status}; |
| 2 | use serde::{Deserialize, Serialize}; |
| 3 | |
| 4 | #[derive(Debug, Serialize)] |
| 5 | pub struct LoginArgs { |
| 6 | pub username: String, |
| 7 | pub password: String, |
| 8 | } |
| 9 | |
| 10 | #[derive(Debug, Serialize)] |
| 11 | pub struct LoginParams { |
| 12 | pub user: UserParam, |
| 13 | } |
| 14 | |
| 15 | #[derive(Debug, Serialize)] |
| 16 | pub struct UserParam { |
| 17 | pub email: String, |
| 18 | pub password: String, |
| 19 | } |
| 20 | |
| 21 | #[derive(Debug, Serialize, Deserialize)] |
| 22 | pub struct LoginResult { |
| 23 | pub status: Status, |
| 24 | pub data: Data, |
| 25 | } |
| 26 | |
| 27 | #[cfg(test)] |
| 28 | mod 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 | } |