agent_twitter_client/auth/
config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pub struct AuthConfig {
    pub username: Option<String>,
    pub password: Option<String>,
    pub email: Option<String>,
    pub bearer_token: String,
    pub two_factor_secret: Option<String>,
}

impl AuthConfig {
    pub fn new(bearer_token: String) -> Self {
        Self {
            username: None,
            password: None,
            email: None,
            bearer_token,
            two_factor_secret: None,
        }
    }

    pub fn with_credentials(
        mut self,
        username: String,
        password: String,
        email: Option<String>,
    ) -> Self {
        self.username = Some(username);
        self.password = Some(password);
        self.email = email;
        self
    }
}