Skip to content

Commit

Permalink
test(anilist): add test anilist update manga progress
Browse files Browse the repository at this point in the history
  • Loading branch information
josueBarretogit committed Nov 7, 2024
1 parent 310476b commit 9ca7a4e
Show file tree
Hide file tree
Showing 3 changed files with 399 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod error_log;
pub mod fetch;
pub mod filter;
pub mod migration;
pub mod tracker;
pub mod tui;

#[derive(Display, EnumIter)]
Expand Down
30 changes: 30 additions & 0 deletions src/backend/tracker.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use futures::Future;
use manga_tui::SearchTerm;
use serde::{Deserialize, Serialize};

pub mod anilist;

#[derive(Debug, Deserialize, Serialize, Default, PartialEq, Eq)]
pub struct MangaToTrack {
pub id: String,
}

#[derive(Debug, Default, PartialEq, Eq)]
pub struct MarkAsRead<'a> {
pub id: &'a str,
pub chapter_number: u32,
pub volume_number: Option<u32>,
}

pub trait MangaTracker {
fn search_manga_by_title(
&self,
title: SearchTerm,
) -> impl Future<Output = Result<Option<MangaToTrack>, Box<dyn std::error::Error>>> + Send;

/// Implementors may require api key / account token in order to perform this operation
fn mark_manga_as_read_with_chapter_count(
&self,
manga: MarkAsRead<'_>,
) -> impl Future<Output = Result<(), Box<dyn std::error::Error>>> + Send;
}
Loading

0 comments on commit 9ca7a4e

Please sign in to comment.