1use reqwest_middleware::reqwest::StatusCode;
2use std::error::Error;
3use strum::Display;
4
5pub mod client;
7pub mod illusts;
9pub mod models;
11pub mod search;
13pub mod tokens;
15pub mod ugoira;
17pub mod users;
19
20#[cfg(feature = "clap")]
21pub use clap;
22pub use reqwest_middleware::reqwest;
23#[cfg(feature = "sqlx")]
24pub use sqlx;
25
26#[derive(Debug, Clone, Display)]
28pub enum PixivAppError {
29 #[strum(to_string = "Requested endpoint not found")]
31 TargetNotFound,
32 #[strum(to_string = "Request failed, check request parameters!")]
34 RequestFailed,
35 #[strum(to_string = "Request failed because of missing authorization!")]
37 MissingLogin,
38 #[strum(to_string = "Too many requests, try again later")]
41 RateLimitReached,
42 #[strum(to_string = "{0}")]
45 UnhandledStatus(StatusCode),
46 #[strum(to_string = "An unknown error happened and no data was returned.")]
48 Unknown,
49}
50
51impl Error for PixivAppError {}