use crate::generated::*;
pub trait HomepageProvider {
fn get_homepage_request(&self) -> Vec<HttpRequest>;
fn process_homepage_res(&self, responses: Vec<HttpResponse>) -> Result<Homepage, String>;
fn get_viewmore_request(&self, section_id: &str, page: u32) -> HttpRequest;
fn process_viewmore_res(
&self,
response: HttpResponse,
) -> Result<PagedResults<SectionEntry>, String>;
}
pub trait MangaProvider {
fn get_manga_request(&self, manga_id: &str) -> HttpRequest;
fn process_manga_res(&self, response: HttpResponse) -> Result<Manga, String>;
fn get_chapters_request(&self, manga_id: &str) -> HttpRequest;
fn process_chapters_res(&self, response: HttpResponse) -> Result<Vec<ChapterEntry>, String>;
fn get_chapter_details_request(&self, manga_id: &str, chapter_id: &str) -> Vec<HttpRequest>;
fn process_chapter_details_res(&self, responses: Vec<HttpResponse>) -> Result<Chapter, String>;
}
pub trait SourceMetadataProvider {
fn get_metadata(&self) -> MetadataSchema;
}
pub trait SearchProvider {
fn get_search_request(&self, query: &SearchRequest) -> HttpRequest;
fn process_search_res(
&self,
response: HttpResponse,
) -> Result<PagedResults<MangaEntry>, String>;
fn get_search_tags_request(&self) -> HttpRequest;
fn process_search_tags_res(&self, response: HttpResponse) -> Result<Vec<Tag>, String>;
}
pub trait SourceProvider:
HomepageProvider + SearchProvider + MangaProvider + SourceMetadataProvider
{
fn get_source_info(&self) -> SourceInfo;
}
pub trait WasmExtension {
fn get_source_info(&self) -> String; fn get_metadata(&self) -> String;
fn get_homepage_request(&self) -> String; fn process_homepage_res(&self, responses_json: &str) -> String; fn get_viewmore_request(&self, section_id: &str, page: u32) -> String; fn process_viewmore_res(&self, response_json: &str) -> String;
fn get_search_request(&self, query_json: &str) -> String; fn process_search_res(&self, response_json: &str) -> String; fn get_search_tags_request(&self) -> String; fn process_search_tags_res(&self, response_json: &str) -> String;
fn get_manga_request(&self, manga_id: &str) -> String; fn process_manga_res(&self, response_json: &str) -> String; fn get_chapters_request(&self, manga_id: &str) -> String; fn process_chapters_res(&self, response_json: &str) -> String; fn get_chapter_details_request(&self, manga_id: &str, chapter_id: &str) -> String; fn process_chapter_details_res(&self, responses_json: &str) -> String; }