1mod client_metadata;
2mod metadata;
3mod request;
4mod response;
5mod token;
6
7pub use self::client_metadata::*;
8pub use self::metadata::*;
9pub use self::request::*;
10pub use self::response::*;
11pub use self::token::*;
12use crate::atproto::{KnownScope, Scope};
13use serde::Deserialize;
14
15#[derive(Debug, Deserialize)]
16pub enum AuthorizeOptionPrompt {
17 Login,
18 None,
19 Consent,
20 SelectAccount,
21}
22
23impl From<AuthorizeOptionPrompt> for String {
24 fn from(value: AuthorizeOptionPrompt) -> Self {
25 match value {
26 AuthorizeOptionPrompt::Login => String::from("login"),
27 AuthorizeOptionPrompt::None => String::from("none"),
28 AuthorizeOptionPrompt::Consent => String::from("consent"),
29 AuthorizeOptionPrompt::SelectAccount => String::from("select_account"),
30 }
31 }
32}
33
34#[derive(Debug, Deserialize)]
35pub struct AuthorizeOptions {
36 pub redirect_uri: Option<String>,
37 pub scopes: Vec<Scope>,
38 pub prompt: Option<AuthorizeOptionPrompt>,
39 pub state: Option<String>,
40}
41
42impl Default for AuthorizeOptions {
43 fn default() -> Self {
44 Self {
45 redirect_uri: None,
46 scopes: vec![Scope::Known(KnownScope::Atproto)],
47 prompt: None,
48 state: None,
49 }
50 }
51}
52
53#[derive(Debug, Deserialize)]
54pub struct CallbackParams {
55 pub code: String,
56 pub state: Option<String>,
57 pub iss: Option<String>,
58}