mangadex_api_types_rust/
oauth.rs

1use std::fmt::Display;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, Eq, Serialize)]
6#[serde(rename_all = "snake_case")]
7#[cfg_attr(feature = "specta", derive(specta::Type))]
8#[non_exhaustive]
9pub enum GrantTypeSupported {
10    RefreshToken,
11    Password,
12    AuthorizationCode,
13    ClientCredentials,
14}
15
16impl Display for GrantTypeSupported {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18        f.write_str(match self {
19            GrantTypeSupported::RefreshToken => "refresh_token",
20            GrantTypeSupported::Password => "password",
21            GrantTypeSupported::AuthorizationCode => "authorization_code",
22            GrantTypeSupported::ClientCredentials => "client_credentials",
23        })
24    }
25}