view src/services/services.cc @ 291:9a88e1725fd2

*: refactor lots of stuff I forgot to put this into different commits, oops! anyway, it doesn't really matter *that* much since this is an unfinished hobby project anyway. once it starts getting stable commit history will be more important, but for now it's not that big of a deal
author Paper <paper@paper.us.eu.org>
date Sun, 12 May 2024 16:31:07 -0400
parents 657fda1b9cac
children 2115488eb302
line wrap: on
line source

#include "services/services.h"
#include "core/session.h"
#include "gui/dialog/settings.h"
#include "services/anilist.h"

namespace Services {

void Synchronize() {
	switch (session.config.service) {
		case Anime::Service::AniList: AniList::GetAnimeList(); break;
		default: break;
	}
}

std::vector<int> Search(const std::string& search) {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::Search(search);
		default: return {};
	}
}

void UpdateAnimeEntry(int id) {
	switch (session.config.service) {
		case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break;
		default: break;
	}
}

bool Authorize() {
	switch (session.config.service) {
		case Anime::Service::AniList: return AniList::AuthorizeUser();
		default: return true;
	}
}

}; // namespace Services