comparison src/include/anilist.h @ 1:1ae666fdf9e2

*: initial commit
author Paper <mrpapersonic@gmail.com>
date Tue, 08 Aug 2023 19:49:15 -0400
parents
children 23d0d9319a00
comparison
equal deleted inserted replaced
0:5a76e1b94163 1:1ae666fdf9e2
1 #ifndef __anilist_h
2 #define __anilist_h
3 #include <curl/curl.h>
4 #include "anime.h"
5 class AniList {
6 public:
7 int Authorize();
8 int GetUserId(std::string name);
9 int UpdateAnimeList(std::vector<AnimeList>* anime_lists, int id);
10
11 private:
12 static size_t CurlWriteCallback(void *contents, size_t size, size_t nmemb, void *userdata);
13 enum AnimeWatchingStatus ConvertWatchingStatusToEnum(std::string status);
14 enum AnimeAiringStatus ConvertAiringStatusToEnum(std::string status);
15 enum AnimeFormat ConvertFormatToEnum(std::string format);
16 enum AnimeSeason ConvertSeasonToEnum(std::string season);
17 std::string SendRequest(std::string data);
18 CURL* curl;
19 CURLcode res;
20 };
21
22 /* FIXME: at some point, we have to add a separate Date class (which IIRC
23 Kitsu actually does as well), because the standard library functions do
24 not support any null values. Internally, we could represent null or undefined
25 values as... -1?. Also, anything anime-related should probably be in an
26 Anime namespace. */
27 #define ANILIST_DATE_IS_VALID(a) \
28 (a["year"].is_number() && a["month"].is_number() && a["day"].is_number())
29 #define ANILIST_DATE_TO_YMD(a) \
30 std::chrono::year_month_day(std::chrono::year(a["year"].get<int>()), \
31 std::chrono::month(a["month"].get<int>()), \
32 std::chrono::day(a["day"].get<int>()))
33 #endif // __anilist_h