mangadex_api_types_rust/
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
use std::fmt::Display;

use serde::{Deserialize, Serialize};

#[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub enum GrantTypeSupported {
    RefreshToken,
    Password,
    AuthorizationCode,
    ClientCredentials,
}

impl Display for GrantTypeSupported {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            GrantTypeSupported::RefreshToken => "refresh_token",
            GrantTypeSupported::Password => "password",
            GrantTypeSupported::AuthorizationCode => "authorization_code",
            GrantTypeSupported::ClientCredentials => "client_credentials",
        })
    }
}