comparison src/include/anilist.h @ 2:23d0d9319a00

Update Also converted everything to LF from CRLF
author Paper <mrpapersonic@gmail.com>
date Sat, 12 Aug 2023 03:16:26 -0400
parents 1ae666fdf9e2
children 1d82f6e04d7d
comparison
equal deleted inserted replaced
1:1ae666fdf9e2 2:23d0d9319a00
1 #ifndef __anilist_h 1 #ifndef __anilist_h
2 #define __anilist_h 2 #define __anilist_h
3 #include <curl/curl.h> 3 #include <curl/curl.h>
4 #include "anime.h" 4 #include "anime.h"
5 #include "json.h"
5 class AniList { 6 class AniList {
6 public: 7 public:
7 int Authorize(); 8 int Authorize();
8 int GetUserId(std::string name); 9 int GetUserId(std::string name);
9 int UpdateAnimeList(std::vector<AnimeList>* anime_lists, int id); 10 int UpdateAnimeList(std::vector<AnimeList>* anime_lists, int id);
16 enum AnimeSeason ConvertSeasonToEnum(std::string season); 17 enum AnimeSeason ConvertSeasonToEnum(std::string season);
17 std::string SendRequest(std::string data); 18 std::string SendRequest(std::string data);
18 CURL* curl; 19 CURL* curl;
19 CURLcode res; 20 CURLcode res;
20 }; 21 };
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 22 #endif // __anilist_h