Move relevant structs to lemmy module
This commit is contained in:
parent
6bd7369ecc
commit
e5862ba0ec
1 changed files with 14 additions and 0 deletions
14
src/lemmy.rs
14
src/lemmy.rs
|
@ -9,12 +9,26 @@ use lemmy_db_schema::newtypes::{CommunityId, PostId};
|
||||||
use lemmy_db_schema::{ListingType, PostFeatureType};
|
use lemmy_db_schema::{ListingType, PostFeatureType};
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
pub(crate) struct Lemmy {
|
pub(crate) struct Lemmy {
|
||||||
jwt_token: Sensitive<String>,
|
jwt_token: Sensitive<String>,
|
||||||
instance: String,
|
instance: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub(crate) struct PostInfoInner {
|
||||||
|
pub(crate) title: String,
|
||||||
|
pub(crate) url: Url,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) trait PostInfo {
|
||||||
|
fn get_info(&self) -> PostInfoInner;
|
||||||
|
|
||||||
|
fn get_description(&self) -> Option<String>;
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn login(config: &Config) -> Result<Lemmy, ()> {
|
pub(crate) async fn login(config: &Config) -> Result<Lemmy, ()> {
|
||||||
let login_params = Login {
|
let login_params = Login {
|
||||||
username_or_email: config.get_username(),
|
username_or_email: config.get_username(),
|
||||||
|
|
Loading…
Reference in a new issue