File indexing completed on 2024-04-28 04:43:01

0001 /*
0002  * Copyright (C) 2014 David Faure <faure@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef _TMDBQT_THEMOVIEDBAPI_H_
0021 #define _TMDBQT_THEMOVIEDBAPI_H_
0022 
0023 #include "tmdbqt_export.h"
0024 #include <QObject>
0025 
0026 namespace TmdbQt
0027 {
0028 class SearchJob;
0029 class TvSearchJob;
0030 class CreditsJob;
0031 class MovieInfoJob;
0032 class TvShowInfoJob;
0033 class TvSeasonInfoJob;
0034 class Configuration;
0035 class TheMovieDbApiPrivate;
0036 
0037 /**
0038  * @brief The TheMovieDbApi class provides the main API for accessing
0039  * TheMovieDatabase.org (also known as TMDB).
0040  */
0041 class TMDBQT_EXPORT TheMovieDbApi : public QObject
0042 {
0043     Q_OBJECT
0044 public:
0045     TheMovieDbApi(const QString &apiKey);
0046     ~TheMovieDbApi() override;
0047 
0048     bool isInitialized() const;
0049 
0050     SearchJob *searchMovie(const QString &movieName,
0051                            int searchYear = 0,
0052                            const QString &language = QString());
0053 
0054     TvSearchJob *searchTvShow(const QString &tvShowName,
0055                               int firstAiredYear = 0,
0056                               const QString &language = QString());
0057 
0058     MovieInfoJob *getMovieInfo(int movieId);
0059     TvShowInfoJob *getTvShowInfo(int tvshowId);
0060     TvSeasonInfoJob *getTvSeasonInfo(int tvshowId, int seasonNum);
0061     CreditsJob *getCredits(int movieId);
0062     CreditsJob *getEpisodeCredits(int tvShowId, int seasonNum, int episodeNum);
0063 
0064     Configuration &configuration() const;
0065 
0066 Q_SIGNALS:
0067     /**
0068      * Emitted when the initialization is done. Wait for this signal before calling other methods!
0069      */
0070     void initialized();
0071 
0072 private:
0073     TheMovieDbApiPrivate *d;
0074 };
0075 
0076 } // namespace
0077 
0078 #endif