thunderstore_api/models/v2/
authenticate.rs1#[cfg(feature = "ts-rs")]
14use ts_rs::TS;
15
16#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
17#[cfg_attr(feature = "ts-rs", derive(TS))]
18#[cfg_attr(feature = "ts-rs", ts(export))]
19pub struct RequestBody {
20 pub code: String,
21 pub redirect_uri: String,
22}
23
24impl RequestBody {
25 #[must_use]
26 pub fn new(code: String, redirect_uri: String) -> RequestBody {
27 RequestBody { code, redirect_uri }
28 }
29}
30
31#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
32#[cfg_attr(feature = "ts-rs", derive(TS))]
33#[cfg_attr(feature = "ts-rs", ts(export))]
34pub struct ResponseBody {
35 pub email: Option<String>,
36 pub session_id: String,
37 pub username: String,
38}
39
40impl ResponseBody {
41 #[must_use]
42 pub fn new(email: Option<String>, session_id: String, username: String) -> ResponseBody {
43 ResponseBody {
44 email,
45 session_id,
46 username,
47 }
48 }
49}