use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub(crate) struct ClientRegistration { pub client_id: String, pub client_id_issued_at: u64, pub grant_types: Vec, } #[derive(Debug, Serialize, Deserialize)] pub(crate) struct ClientRegisterReq { pub client_name: String, pub client_uri: String, pub grant_types: Vec, pub application_type: String, pub token_endpoint_auth_method: String, } #[derive(Debug, Serialize, Deserialize)] pub(crate) struct AuthMetadata { pub device_authorization_endpoint: String, pub token_endpoint: String, pub registration_endpoint: String, } #[derive(Debug, Serialize, Deserialize)] pub(crate) struct DeviceGrant { pub device_code: String, pub user_code: String, pub verification_uri: String, pub verification_uri_complete: String, pub expires_in: u64, pub interval: u64, } #[derive(Debug, Serialize, Deserialize)] pub(crate) struct AuthorizationToken { pub token_type: String, pub access_token: String, pub refresh_token: String, pub expires_in: u64, pub scope: String, } #[allow(dead_code)] pub fn prettify_json_str(json_str: &str) -> Result { let Ok(json) = serde_json::from_str::(json_str) else { return Err(()); }; match serde_json::to_string_pretty(&json) { Ok(s) => Ok(s), Err(_) => Err(()), } }