diff --git a/src/api/schemas.rs b/src/api/schemas.rs index c53f183..df44cfc 100644 --- a/src/api/schemas.rs +++ b/src/api/schemas.rs @@ -114,26 +114,6 @@ pub mod schemas { gift_code_sku_id: Option, } - impl LoginSchema { - pub fn new( - login: String, - password: String, - undelete: Option, - captcha_key: Option, - login_source: Option, - gift_code_sku_id: Option, - ) -> LoginSchema { - LoginSchema { - login, - password, - undelete, - captcha_key, - login_source, - gift_code_sku_id, - } - } - } - #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub struct TotpSchema { @@ -142,6 +122,19 @@ pub mod schemas { gift_code_sku_id: Option, login_source: Option, } + + #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] + #[serde(rename_all = "camelCase")] + pub struct InstancePoliciesSchema { + instance_name: String, + instance_description: Option, + front_page: Option, + tos_page: Option, + correspondence_email: Option, + correspondence_user_id: Option, + image: Option, + instance_id: Option, + } } // I know that some of these tests are... really really basic and unneccessary, but sometimes, I diff --git a/src/client.rs b/src/client.rs deleted file mode 100644 index 2033808..0000000 --- a/src/client.rs +++ /dev/null @@ -1,10 +0,0 @@ -use crate::gateway::Gateway; -use crate::limit::LimitedRequester; - -struct ClientBuilder {} - -/* impl ClientBuilder { - fn build() -> Client {} -} */ - -struct Client {} diff --git a/src/instance.rs b/src/instance.rs new file mode 100644 index 0000000..b2f6f91 --- /dev/null +++ b/src/instance.rs @@ -0,0 +1,14 @@ +use crate::api::schemas::schemas::InstancePoliciesSchema; +use crate::gateway::Gateway; +use crate::limit::LimitedRequester; +use crate::URLBundle; + +use std::collections::HashMap; + +#[derive(Debug)] +pub struct Instance { + main_url: String, + urls: URLBundle, + instance_info: InstancePoliciesSchema, + requester: LimitedRequester, +} diff --git a/src/lib.rs b/src/lib.rs index ee1ae54..838f31b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,11 @@ mod api; -mod client; mod gateway; +mod instance; mod limit; mod voice; use url::{ParseError, Url}; -#[derive(Clone, Default, Debug)] +#[derive(Clone, Default, Debug, PartialEq, Eq)] /// A URLBundle is a struct which bundles together the API-, Gateway- and CDN-URLs of a Spacebar /// instance.