duoload 0.1.2

Export vocabulary from Duocards
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::duocards::models::{DuocardsResponse, VocabularyCard};
use crate::error::Result;
use async_trait::async_trait;

pub mod client;
pub mod deck;
pub mod models;

pub use client::DuocardsClient;

#[async_trait]
pub trait DuocardsClientTrait: Send + Sync {
    async fn fetch_page(&self, deck_id: &str, cursor: Option<String>) -> Result<DuocardsResponse>;
    fn convert_to_vocabulary_cards(&self, response: &DuocardsResponse) -> Vec<VocabularyCard>;
    fn should_continue(&self, current_page: u32) -> bool;
    fn page_limit(&self) -> Option<u32>;
}