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