Merge pull request #2 from polyphony-chat/feature/client

Feature/client
This commit is contained in:
Flori 2023-04-16 22:53:20 +02:00 committed by GitHub
commit ccbe7122fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 32 deletions

View File

@ -114,26 +114,6 @@ pub mod schemas {
gift_code_sku_id: Option<String>,
}
impl LoginSchema {
pub fn new(
login: String,
password: String,
undelete: Option<bool>,
captcha_key: Option<String>,
login_source: Option<String>,
gift_code_sku_id: Option<String>,
) -> 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<String>,
login_source: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct InstancePoliciesSchema {
instance_name: String,
instance_description: Option<String>,
front_page: Option<String>,
tos_page: Option<String>,
correspondence_email: Option<String>,
correspondence_user_id: Option<String>,
image: Option<String>,
instance_id: Option<String>,
}
}
// I know that some of these tests are... really really basic and unneccessary, but sometimes, I

View File

@ -1,10 +0,0 @@
use crate::gateway::Gateway;
use crate::limit::LimitedRequester;
struct ClientBuilder {}
/* impl ClientBuilder {
fn build() -> Client {}
} */
struct Client {}

14
src/instance.rs Normal file
View File

@ -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,
}

View File

@ -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.