1 use {
2 crate::account::Data,
3 serde::{Deserialize, Serialize},
4 std::fmt::{Display, Formatter},
5 tsync::tsync,
6 };
7
8 pub struct SignupArgs {
9 pub email: String,
10 pub password: Option<String>,
11 pub password_confirmation: Option<String>,
12 pub authorizations_attributes: Vec<Provider>,
13 }
14
15 #[derive(Debug, Serialize)]
16 pub struct Provider {
17 pub uid: String,
18 pub provider: i8,
19 }
20
21 #[derive(Debug, Serialize)]
22 pub struct SignupGithubParams {
23 pub user: SignupUserGithub,
24 }
25
26 #[derive(Debug, Serialize)]
27 pub struct SignupEmailParams {
28 pub user: SignupUserEmail,
29 }
30
31 #[derive(Debug, Serialize)]
32 pub struct SignupUserGithub {
33 pub email: String,
34 pub authorizations_attributes: Vec<Provider>,
35 }
36
37 #[derive(Debug, Serialize)]
38 pub struct SignupUserEmail {
39 pub email: String,
40 pub password: String,
41 }
42
43 #[derive(Debug, Serialize, Deserialize)]
44 #[tsync]
45 pub struct SignupResult {
46 pub code: Option<i32>,
47 pub message: String,
48 pub data: Option<Data>,
49 }
50
51 #[derive(Debug, Serialize, Deserialize)]
52 pub struct GithubUser {
53 pub email: Option<String>,
54 pub name: String,
55 }
56
57 #[derive(Debug, Serialize, Deserialize)]
58 pub struct GithubEmail {
59 pub email: String,
60 primary: bool,
61 verified: bool,
62 visibility: Option<String>,
63 }
64
65 impl Display for GithubEmail {
66 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
67 write!(f, "{}", self.email)
68 }
69 }
70
71 #[cfg(test)]
72 mod tests {}