Create domains_config, create Domains struct

This commit is contained in:
bitfl0wer 2023-12-03 13:04:02 +01:00
parent 9bec639634
commit 25a09c3980
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,29 @@
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Eq, PartialEq, Hash, Clone, Debug)]
/// Represents the result of the `$rooturl/.well-known/spacebar` endpoint.
///
/// See <https://docs.spacebar.chat/setup/server/wellknown/> for more information.
pub struct WellKnownResponse {
pub api: String,
}
#[derive(Deserialize, Serialize, Eq, PartialEq, Hash, Clone, Debug)]
#[serde(rename_all = "camelCase")]
/// Represents the result of the `$api/policies/instance/domains` endpoint.
pub struct Domains {
pub cdn: String,
pub gateway: String,
pub api_endpoint: String,
pub default_api_version: String,
}
impl std::fmt::Display for Domains {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{{\n\tCDN URL: {},\n\tGateway URL: {},\n\tAPI Endpoint: {},\n\tDefault API Version: {}\n}}",
self.cdn, self.gateway, self.api_endpoint, self.default_api_version
)
}
}

View File

@ -1,6 +1,7 @@
pub mod api_configuration;
pub mod cdn_configuration;
pub mod defaults_configuration;
pub mod domains_configuration;
pub mod email_configuration;
pub mod endpoint_configuration;
pub mod external_tokens_configuration;