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