diff src/services/services.cc @ 317:b1f4d1867ab1

services: VERY initial Kitsu support it only supports user authentication for now, but it's definitely a start.
author Paper <paper@paper.us.eu.org>
date Wed, 12 Jun 2024 04:07:10 -0400
parents 2115488eb302
children 1b5c04268d6a
line wrap: on
line diff
--- a/src/services/services.cc	Tue Jun 11 15:11:09 2024 -0400
+++ b/src/services/services.cc	Wed Jun 12 04:07:10 2024 -0400
@@ -1,13 +1,14 @@
 #include "services/services.h"
 #include "core/session.h"
-#include "gui/dialog/settings.h"
 #include "services/anilist.h"
+#include "services/kitsu.h"
 
 namespace Services {
 
 void Synchronize() {
 	switch (session.config.service) {
 		case Anime::Service::AniList: AniList::GetAnimeList(); break;
+		case Anime::Service::Kitsu: Kitsu::GetAnimeList(); break;
 		default: break;
 	}
 }
@@ -15,6 +16,7 @@
 std::vector<int> Search(const std::string& search) {
 	switch (session.config.service) {
 		case Anime::Service::AniList: return AniList::Search(search);
+		case Anime::Service::Kitsu: return Kitsu::Search(search);
 		default: return {};
 	}
 }
@@ -22,6 +24,7 @@
 std::vector<int> GetSeason(Anime::SeriesSeason season, Date::Year year) {
 	switch (session.config.service) {
 		case Anime::Service::AniList: return AniList::GetSeason(season, year);
+		case Anime::Service::Kitsu: return Kitsu::GetSeason(season, year);
 		default: return {};
 	}
 }
@@ -29,15 +32,9 @@
 void UpdateAnimeEntry(int id) {
 	switch (session.config.service) {
 		case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break;
+		case Anime::Service::Kitsu: Kitsu::UpdateAnimeEntry(id); break;
 		default: break;
 	}
 }
 
-bool Authorize() {
-	switch (session.config.service) {
-		case Anime::Service::AniList: return AniList::AuthorizeUser();
-		default: return true;
-	}
-}
-
 }; // namespace Services