Move relevant structs to lemmy module

This commit is contained in:
Neshura 2024-01-08 21:06:52 +01:00
parent 6bd7369ecc
commit e5862ba0ec
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -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(),