mal_query/
lib.rs

1//! # Mal_Query
2//! This crate connects to the MyAnimeList public API v2 Beta, and allows the user to intuitively receive anime
3//! data.
4//! # Examples
5//! ```
6//! use mal_query::myanimelist::{
7//!     self, 
8//!     builders::*, 
9//!     models::*,
10//!     retrieval::*,
11//!     user::*
12//! }
13//! 
14//! #[tokio::main]
15//! async fn example() {
16//!     // Logging in
17//!     match myanimelist::login().await {
18//!         Ok(()) => println!("Login Successful"),
19//!         Err(e) => eprintln!("Error: {e}"),
20//!     }
21//! 
22//!     // Searching for anime, getting 5 anime with title, id, and main_picture data
23//!     let one_search: MalAnimeSearch = search_anime("One Piece", 5).await.unwrap();
24//! 
25//!     // Getting anime by MyAnimeList ID, getting full MyAnimeList details
26//!     let one_piece_detailed: MalAnimeData = get_anime(21).await.unwrap();
27//! 
28//!     // Getting seasonal data, getting every available anime, with title, id, and main_picture data
29//!     let winter_2023: MalAnimeSearch = get_season(2023, Season::Winter).await.unwrap();
30//! 
31//!     // Getting anime by MyAnimeList URL, getting full MyAnimeList details
32//!     let one_piece_by_url: MalAnimeData = get_anime_from_url("https://myanimelist.net/anime/21/One_Piece").await.unwrap();
33//! 
34//!     // Gets the top 10 anime of all time, according to MyAnimeList, with title, id, and main_picture data
35//!     let rankings: MalAnimeSearch = get_anime_rankings(RankingType::All, 10).await.unwrap();
36//! 
37//!     // Gets 10 anime entries from a user's database, as long as it is public, or logged in. It contains title, id, and main_picture data
38//!     let test10 = get_user_animelist("naginis_api", 10).await.unwrap();
39//! 
40//!     // Builder to receive specific data from MyAnimeList. Here, title, id, main_picture, rank, and num_episodes
41//!     // There are 3 types of Builders: Builder, SearchBuilder, and SeasonalBuilder
42//!     // All have the same field addons, more in the docs
43//!     let one_piece_builder: MalAnimeData = Builder::new(21)
44//!         .add_rank()
45//!         .add_num_episodes()
46//!         .run()
47//!         .await
48//!         .unwrap();
49//! 
50//!     // UpdateAnime updates an anime in the user's database. The user must be logged in for this to work.
51//!     // `new` can be replace with `from_malanimedata`, to use a MalAnimeData type
52//!     let one_piece_update: ListStatus = UpdateAnime::new(21)
53//!         .update_score(10)
54//!         .expect("Score is invalid")
55//!         .update()
56//!         .await
57//!         .unwrap();
58//! 
59//!     // UserListBuilder receives specific data from a user's list. Here, it is sorted by score, limited by 10, 
60//!     // and includes their list status.
61//!     let user_list = UserListBuilder::new("naginis_api")
62//!         .sort(Sort::ListScore)
63//!         .limit(10)
64//!         .include_list_status()
65//!         .run()
66//!         .await
67//!         .unwrap();
68//! }
69//! ```
70
71// TODO: Launch 1.0
72
73// TODO: Update README to include all data
74// TODO: feature: append_fields to builds, find intuitive way to add many fields, or Fields::All
75
76// TODO: Manga model MalMangaData
77// TODO: search_manga(?)
78// TODO: get_manga(?)
79// TODO: get_manga_rankings(?)
80// TODO: get_manga_by_url(?)
81
82// TODO: Various builders
83
84// TODO: update manga
85// TODO: delete manga
86// TODO: get_user_mangalist
87
88// -- Jikan --
89// TODO: get_anime
90// TODO: get_anime_characters
91// TODO: get_anime_staff
92// etc. https://docs.api.jikan.moe/
93
94pub mod myanimelist;
95
96#[cfg(feature = "jikan")]
97pub mod jikan;