mangadex_api/v5/
oauth.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
pub mod login;
pub mod refresh_token;

use login::RetriveTokensBuilder;
use refresh_token::RefreshTokensBuilder;

use crate::HttpClientRef;

create_endpoint_node! {
    #[name] OAuthBuider OAuthBuiderMethods,
    #[args] {
        http_client: HttpClientRef,
    },
    #[methods] {
        login() -> RetriveTokensBuilder;
        refresh() -> RefreshTokensBuilder;
    }
}

impl OAuthBuiderMethods for OAuthBuider {
    fn login(&self) -> RetriveTokensBuilder {
        RetriveTokensBuilder::default().http_client(<&Self as Into<HttpClientRef>>::into(self))
    }
    fn refresh(&self) -> RefreshTokensBuilder {
        RefreshTokensBuilder::default().http_client(<&Self as Into<HttpClientRef>>::into(self))
    }
}