File indexing completed on 2024-04-21 14:52:21

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org>
0005     SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us>
0006 
0007     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0008 */
0009 
0010 #ifndef ATTICA_PROVIDER_H
0011 #define ATTICA_PROVIDER_H
0012 
0013 #include <QExplicitlySharedDataPointer>
0014 #include <QSharedPointer>
0015 #include <QString>
0016 #include <QStringList>
0017 
0018 #include <QUrl>
0019 
0020 #include "achievement.h"
0021 #include "attica_export.h"
0022 #include "category.h"
0023 #include "comment.h"
0024 #include "distribution.h"
0025 #include "forum.h"
0026 #include "itemjob.h"
0027 #include "license.h"
0028 #include "listjob.h"
0029 #include "message.h"
0030 
0031 class QDate;
0032 class QUrl;
0033 
0034 namespace Attica
0035 {
0036 class PlatformDependent;
0037 
0038 class PostJobStatus;
0039 
0040 class AccountBalance;
0041 class Activity;
0042 class BuildServiceJobOutput;
0043 class BuildServiceJob;
0044 class BuildService;
0045 class PrivateData;
0046 class Config;
0047 class Content;
0048 class DownloadItem;
0049 class Distribution;
0050 class Event;
0051 class Folder;
0052 class HomePageType;
0053 class KnowledgeBaseEntry;
0054 class License;
0055 class Person;
0056 class PostJob;
0057 class Project;
0058 class Provider;
0059 class Publisher;
0060 class PublisherField;
0061 class RemoteAccount;
0062 
0063 /**
0064  * @class Provider provider.h <Attica/Provider>
0065  *
0066  * The Provider class represents one Open Collaboration Service provider.
0067  * Use the ProviderManager to instantiate a Provider.
0068  *
0069  * Accessing functions of the Provider returns a Job class that
0070  * takes care of accessing the server and parsing the result.
0071  *
0072  * Provider files are xml of the form:
0073  <pre>
0074  <provider>
0075  <id>opendesktop</id>
0076  <location>https://api.opendesktop.org/v1/</location>
0077  <name>openDesktop.org</name>
0078  <icon></icon>
0079  <termsofuse>https://opendesktop.org/terms/</termsofuse>
0080  <register>https://opendesktop.org/usermanager/new.php</register>
0081  <services>
0082    <person ocsversion="1.3" />
0083    <friend ocsversion="1.3" />
0084    <message ocsversion="1.3" />
0085    <activity ocsversion="1.3" />
0086    <content ocsversion="1.3" />
0087    <fan ocsversion="1.3" />
0088    <knowledgebase ocsversion="1.3" />
0089    <event ocsversion="1.3" />
0090    <comment ocsversion="1.2" />
0091  </services>
0092 </provider>
0093  </pre>
0094  * The server provides the services specified in the services section, not necessarily all of them.
0095  */
0096 class ATTICA_EXPORT Provider
0097 {
0098 public:
0099     Provider();
0100     Provider(const Provider &other);
0101     Provider &operator=(const Provider &other);
0102     ~Provider();
0103 
0104     /**
0105     Returns true if the provider has been set up and can be used.
0106     */
0107     bool isValid() const;
0108 
0109     /**
0110     Test if the provider is enabled by the settings.
0111     The application can choose to ignore this, but the user settings should be respected.
0112     */
0113     bool isEnabled() const;
0114     void setEnabled(bool enabled);
0115 
0116     /**
0117      * Set a custom identifier for your application (sent along with the requests as
0118      * the http agent header in addition to the application name and version).
0119      *
0120      * For example, you might have an application named SomeApplication, version 23,
0121      * and wish to send along the data "lookandfeel.knsrc". Call this function, and
0122      * the resulting agent header would be:
0123      *
0124      * SomeApplication/23 (+lookandfeel.knsrc)
0125      *
0126      * If you do not set this (or set it to an empty string), the agent string becomes
0127      *
0128      * SomeApplication/23
0129      *
0130      * @param additionalAgentInformation The extra string
0131      * @since 5.66
0132      */
0133     void setAdditionalAgentInformation(const QString &additionalInformation);
0134     /**
0135      * The custom identifier sent along with requests
0136      *
0137      * @return The custom identifier
0138      * @see setAdditionalAgentInformation(const QString&)
0139      * @since 5.66
0140      */
0141     QString additionalAgentInformation() const;
0142 
0143     /**
0144     A url that identifies this provider.
0145     This should be used as identifier when referring to this provider but you don't want to use the full provider object.
0146     */
0147     QUrl baseUrl() const;
0148 
0149     /**
0150     A name for the provider that can be displayed to the user
0151     */
0152     QString name() const;
0153 
0154     /**
0155      * An icon used to visually identify this provider
0156      * @return A URL for an icon image (or an invalid URL if one was not defined by the provider)
0157      * @since 5.85
0158      */
0159     QUrl icon() const;
0160 
0161     enum SortMode {
0162         Newest,
0163         Alphabetical,
0164         Rating,
0165         Downloads,
0166     };
0167 
0168     /**
0169     Test if the server supports the person part of the API
0170     */
0171     bool hasPersonService() const;
0172     /**
0173     Version of the person part of the API
0174     */
0175     QString personServiceVersion() const;
0176 
0177     /**
0178     Test if the server supports the friend part of the API
0179     */
0180     bool hasFriendService() const;
0181 
0182     /**
0183     Version of the friend part of the API
0184     */
0185     QString friendServiceVersion() const;
0186 
0187     /**
0188     Test if the server supports the message part of the API
0189     */
0190     bool hasMessageService() const;
0191     /**
0192     Version of the message part of the API
0193     */
0194     QString messageServiceVersion() const;
0195 
0196     /**
0197     Test if the server supports the achievement part of the API
0198     */
0199     bool hasAchievementService() const;
0200     /**
0201     Version of the achievement part of the API
0202     */
0203     QString achievementServiceVersion() const;
0204 
0205     /**
0206     Test if the server supports the activity part of the API
0207     */
0208     bool hasActivityService() const;
0209     /**
0210     Version of the activity part of the API
0211     */
0212     QString activityServiceVersion() const;
0213 
0214     /**
0215     Test if the server supports the content part of the API
0216     */
0217     bool hasContentService() const;
0218     /**
0219     Version of the content part of the API
0220     */
0221     QString contentServiceVersion() const;
0222 
0223     /**
0224     Test if the server supports the fan part of the API
0225     */
0226     bool hasFanService() const;
0227     /**
0228     Version of the fan part of the API
0229     */
0230     QString fanServiceVersion() const;
0231 
0232     /**
0233     Test if the server supports the forum part of the API
0234     */
0235     bool hasForumService() const;
0236     /**
0237     Version of the forum part of the API
0238     */
0239     QString forumServiceVersion() const;
0240 
0241     /**
0242      *
0243     Test if the server supports the knowledgebase part of the API
0244     */
0245     bool hasKnowledgebaseService() const;
0246     /**
0247     Version of the knowledgebase part of the API
0248     */
0249     QString knowledgebaseServiceVersion() const;
0250 
0251     /**
0252     Test if the server supports the comments part of the API
0253     */
0254     bool hasCommentService() const;
0255     /**
0256     Version of the comments part of the API
0257     */
0258     QString commentServiceVersion() const;
0259 
0260     /**
0261       Test if the provider has user name/password available.
0262       This does not yet open kwallet in case the KDE plugin is used.
0263       @return true if the provider has login information
0264     */
0265     bool hasCredentials() const;
0266     bool hasCredentials();
0267 
0268     /**
0269       Load user name and password from the store.
0270       Attica will remember the loaded values and use them from this point on.
0271       @param user reference that returns the user name
0272       @param password reference that returns the password
0273       @return if credentials could be loaded
0274     */
0275     bool loadCredentials(QString &user, QString &password);
0276 
0277     /**
0278       Sets (and remembers) user name and password for this provider.
0279       To remove the data an empty username should be passed.
0280       @param user the user (login) name
0281       @param password the password
0282       @return if credentials could be saved
0283     */
0284     bool saveCredentials(const QString &user, const QString &password);
0285 
0286     /**
0287       Test if the server accepts the login/password.
0288       This function does not actually set the credentials. Use saveCredentials for that purpose.
0289       @param user the user (login) name
0290       @param password the password
0291       @return the job that will contain the success of the login as metadata
0292     */
0293     PostJob *checkLogin(const QString &user, const QString &password);
0294 
0295     /**
0296      * Fetches server config
0297      * @return The job responsible for fetching data
0298      */
0299     ItemJob<Config> *requestConfig();
0300 
0301     // Person part of OCS
0302 
0303     PostJob *registerAccount(const QString &id, const QString &password, const QString &mail, const QString &firstName, const QString &lastName);
0304     ItemJob<Person> *requestPerson(const QString &id);
0305     ItemJob<Person> *requestPersonSelf();
0306     ItemJob<AccountBalance> *requestAccountBalance();
0307     ListJob<Person> *requestPersonSearchByName(const QString &name);
0308     ListJob<Person> *requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance = 0.0, int page = 0, int pageSize = 20);
0309     PostJob *postLocation(qreal latitude, qreal longitude, const QString &city = QString(), const QString &country = QString());
0310 
0311     //////////////////////////
0312     // PrivateData part of OCS
0313 
0314     /**
0315      * Fetches the a given attribute from an OCS-compliant server.
0316      * @param app The application name
0317      * @param key The key of the attribute to fetch (optional)
0318      * @return The job that is responsible for fetching the data
0319      */
0320     ItemJob<PrivateData> *requestPrivateData(const QString &app, const QString &key = QString());
0321 
0322     /**
0323      * Fetches all stored private data.
0324      * @return The job responsible for fetching data
0325      */
0326     ItemJob<PrivateData> *requestPrivateData()
0327     {
0328         return requestPrivateData(QString(), QString());
0329     }
0330 
0331     /**
0332      * Sets the value of an attribute.
0333      * @param app The application name
0334      * @param key The key of the attribute
0335      * @param value The new value of the attribute
0336      * @return The job responsible for setting data
0337      */
0338     PostJob *setPrivateData(const QString &app, const QString &key, const QString &value);
0339 
0340     // Friend part of OCS
0341 
0342     ListJob<Person> *requestFriends(const QString &id, int page = 0, int pageSize = 20);
0343     ListJob<Person> *requestSentInvitations(int page = 0, int pageSize = 20);
0344     ListJob<Person> *requestReceivedInvitations(int page = 0, int pageSize = 20);
0345     PostJob *inviteFriend(const QString &to, const QString &message);
0346     PostJob *approveFriendship(const QString &to);
0347     PostJob *declineFriendship(const QString &to);
0348     PostJob *cancelFriendship(const QString &to);
0349 
0350     // Message part of OCS
0351 
0352     ListJob<Folder> *requestFolders();
0353     ListJob<Message> *requestMessages(const Folder &folder);
0354     ListJob<Message> *requestMessages(const Folder &folder, Message::Status status);
0355     ItemJob<Message> *requestMessage(const Folder &folder, const QString &id);
0356     PostJob *postMessage(const Message &message);
0357 
0358     // Achievement part of OCS
0359     /**
0360      * Get a list of achievements
0361      * @return ListJob listing Achievements
0362      */
0363     ListJob<Achievement> *requestAchievements(const QString &contentId, const QString &achievementId, const QString &userId);
0364 
0365     /** Add a new achievement.
0366      * @param id id of the achievement entry
0367      * @param achievement The new Achievement added
0368      * @return item post job for adding the new achievement
0369      */
0370     ItemPostJob<Achievement> *addNewAchievement(const QString &id, const Achievement &newAchievement);
0371 
0372     /**
0373      * Post modifications to an Achievement on the server
0374      * @param achievement Achievement to update on the server
0375      */
0376     PutJob *editAchievement(const QString &contentId, const QString &achievementId, const Achievement &achievement);
0377 
0378     /**
0379      * Deletes an achievement on the server. The achievement passed as an argument doesn't need complete
0380      * information as just the id() is used.
0381      * @param achievement Achievement to delete on the server.
0382      */
0383     DeleteJob *deleteAchievement(const QString &contentId, const QString &achievementId);
0384 
0385     // PostJob* postAchievement(const Achievement& achievement);
0386     PostJob *setAchievementProgress(const QString &id, const QVariant &progress, const QDateTime &timestamp);
0387     DeleteJob *resetAchievementProgress(const QString &id);
0388 
0389     // Activity part of OCS
0390 
0391     ListJob<Activity> *requestActivities();
0392     PostJob *postActivity(const QString &message);
0393 
0394     // Project part of OCS
0395     /**
0396      * Get a list of build service projects
0397      * @return ListJob listing Projects
0398      */
0399     ListJob<Project> *requestProjects();
0400 
0401     /**
0402      * Get a Project's data
0403      * @return ItemJob receiving data
0404      */
0405     ItemJob<Project> *requestProject(const QString &id);
0406 
0407     /**
0408      * Post modifications to a Project on the server. The resulting project ID can be found in
0409      * the Attica::MetaData of the finished() PostJob. You can retrieve it using
0410      * Attica::MetaData::resultingProjectId().
0411      * @param project Project to create on the server
0412      */
0413     PostJob *createProject(const Project &project);
0414 
0415     /**
0416      * Deletes a project on the server. The project passed as an argument doesn't need complete
0417      * information as just the id() is used.
0418      * @param project Project to delete on the server.
0419      */
0420     PostJob *deleteProject(const Project &project);
0421 
0422     /**
0423      * Post modifications to a Project on the server
0424      * @param project Project to update on the server
0425      */
0426     PostJob *editProject(const Project &project);
0427 
0428     // Buildservice part of OCS
0429 
0430     /**
0431      * Get the information for a specific build service instance.
0432      * @return ItemJob receiving data
0433      */
0434     ItemJob<BuildService> *requestBuildService(const QString &id);
0435 
0436     /**
0437      * Get the information for a specific publisher.
0438      * @return ItemJob receiving data
0439      */
0440     ItemJob<Publisher> *requestPublisher(const QString &id);
0441 
0442     /**
0443      * Save the value of a single publishing field
0444      * @return PostJob*
0445      */
0446     PostJob *savePublisherField(const Project &project, const PublisherField &field);
0447 
0448     /**
0449      * Publish the result of a completed build job to a publisher.
0450      * @return ItemJob receiving data
0451      */
0452     PostJob *publishBuildJob(const BuildServiceJob &buildjob, const Publisher &publisher);
0453 
0454     /**
0455      * Get the build output for a specific build service job
0456      * @return ItemJob receiving and containing the output data
0457      */
0458     ItemJob<BuildServiceJobOutput> *requestBuildServiceJobOutput(const QString &id);
0459 
0460     /**
0461      * Get the information for a specific build service job, such as status and progress.
0462      * @return ItemJob receiving and containing the data
0463      */
0464     ItemJob<BuildServiceJob> *requestBuildServiceJob(const QString &id);
0465 
0466     /**
0467      * Get a list of build service build services
0468      * @return ListJob listing BuildServices
0469      */
0470     ListJob<BuildService> *requestBuildServices();
0471 
0472     /**
0473      * Get a list of publishers
0474      * @return ListJob listing Publishers
0475      */
0476     ListJob<Publisher> *requestPublishers();
0477 
0478     /**
0479      * Get a list of build service projects
0480      * @return ListJob listing BuildServiceJobs
0481      */
0482     ListJob<BuildServiceJob> *requestBuildServiceJobs(const Project &project);
0483 
0484     /**
0485      * Create a new job for a given project on a given buildservice for a given target.
0486      * Those three items are mandatory for the job to succeed.
0487      * @param job Buildservicejob to create on the server
0488      */
0489     PostJob *createBuildServiceJob(const BuildServiceJob &job);
0490 
0491     /**
0492      * Cancel a job.
0493      * Setting the ID on the build service parameter is enough for it to work.
0494      * @param job Buildservicejob to cancel on the server, needs at least id set.
0495      */
0496     PostJob *cancelBuildServiceJob(const BuildServiceJob &job);
0497 
0498     /**
0499      * Get a list of remote accounts, account for a build service instance
0500      * which is stored in the OCS service in order to authenticate with the
0501      * build service instance.
0502      * @return ListJob listing RemoteAccounts
0503      */
0504     ListJob<RemoteAccount> *requestRemoteAccounts();
0505 
0506     /**
0507      * Deletes a remote account stored on the OCS server.
0508      * @param id The ID of the remote account on the OCS instance.
0509      */
0510     PostJob *deleteRemoteAccount(const QString &id);
0511 
0512     /**
0513      * Create a new remote account, an account for a build service instance
0514      * which is stored in the OCS service in order to authenticate with the
0515      * build service instance.
0516      * Type, Type ID, login and password are mandatory.
0517      * @param account RemoteAccount to create on the server
0518      */
0519     PostJob *createRemoteAccount(const RemoteAccount &account);
0520 
0521     /**
0522      * Edit an existing remote account.
0523      * @param account RemoteAccount to create on the server
0524      */
0525     PostJob *editRemoteAccount(const RemoteAccount &account);
0526 
0527     /** Get a remote account by its ID.
0528      * @param id The ID of the remote account
0529      */
0530     ItemJob<RemoteAccount> *requestRemoteAccount(const QString &id);
0531 
0532     /** Upload a tarball to the buildservice.
0533      * @param projectId The ID of the project this source file belongs to
0534      * @param payload A reference to the complete file data
0535      * @return A postjob to keep keep track of the upload
0536      */
0537     Attica::PostJob *uploadTarballToBuildService(const QString &projectId, const QString &fileName, const QByteArray &payload);
0538 
0539     // Content part of OCS
0540 
0541     /**
0542      * Get a list of categories (such as wallpaper)
0543      * @return the categories of the server
0544      */
0545     ListJob<Category> *requestCategories();
0546 
0547     /**
0548      * Get a list of licenses (such as GPL)
0549      * @return the licenses available from the server
0550      */
0551     ListJob<License> *requestLicenses();
0552 
0553     /**
0554      * Get a list of distributions (such as Ark, Debian)
0555      * @return the licenses available from the server
0556      */
0557     ListJob<Distribution> *requestDistributions();
0558 
0559     /**
0560      * Get a list of home page types (such as blog, Facebook)
0561      * @return the licenses available from the server
0562      */
0563     ListJob<HomePageType> *requestHomePageTypes();
0564 
0565     /**
0566       Request a list of Contents.
0567       Note that @p categories is not optional. If left empty, no results will be returned.
0568       An empty search string @p search returns the top n items.
0569       @param categories categories to search in
0570       @param search optional search string (in name/description of the content)
0571       @param mode sorting mode
0572       @param page request nth page in the list of results
0573       @param pageSize requested size of pages when calculating the list of results
0574       @return list job for the search results
0575       */
0576     ListJob<Content> *
0577     searchContents(const Category::List &categories, const QString &search = QString(), SortMode mode = Rating, uint page = 0, uint pageSize = 10);
0578 
0579     /**
0580       Request a list of Contents.
0581       Like @see searchContents, but only contents created by one person.
0582       @param person the person-id that created the contents.
0583      */
0584     ListJob<Content> *searchContentsByPerson(const Category::List &categories,
0585                                              const QString &person,
0586                                              const QString &search = QString(),
0587                                              SortMode mode = Rating,
0588                                              uint page = 0,
0589                                              uint pageSize = 10);
0590 
0591     /**
0592       Request a list of Contents. More complete version.
0593       Note that @p categories is not optional. If left empty, no results will be returned.
0594       An empty search string @p search returns the top n items.
0595       @param categories categories to search in
0596       @param person the person-id that created the contents
0597       @param distributions list of distributions to filter by, if empty no filtering by distribution is done
0598       @param licenses list of licenses to filter by, if empty no filtering by license is done
0599       @param search optional search string (in name/description of the content)
0600       @param mode sorting mode
0601       @param page request nth page in the list of results
0602       @param pageSize requested size of pages when calculating the list of results
0603       @return list job for the search results
0604       */
0605     ListJob<Content> *searchContents(const Category::List &categories,
0606                                      const QString &person,
0607                                      const Distribution::List &distributions,
0608                                      const License::List &licenses,
0609                                      const QString &search = QString(),
0610                                      SortMode sortMode = Rating,
0611                                      uint page = 0,
0612                                      uint pageSize = 10);
0613 
0614     /**
0615       Retrieve a single content.
0616       @param contentId the id of the content
0617       @return job that retrieves the content object
0618      */
0619     ItemJob<Content> *requestContent(const QString &contentId);
0620 
0621     ItemJob<DownloadItem> *downloadLink(const QString &contentId, const QString &itemId = QStringLiteral("1"));
0622 
0623 #if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2)
0624     /** Vote for a content item
0625      * This version is for the old OCS API < 1.6
0626      * @param contentId the content which this voting is for
0627      * @param positiveVote whether the voting is positive or negative
0628      * @return the post job for this voting
0629      * @deprecated Since 0.2, use voteForContent(const QString &, uint)
0630      */
0631     ATTICA_DEPRECATED_VERSION(0, 2, "Use Provider::voteForContent(const QString &, uint)")
0632     PostJob *voteForContent(const QString &contentId, bool positiveVote);
0633 #endif
0634 
0635     /** Vote for a content item
0636      * @param contentId the content which this voting is for
0637      * @param rating - the rating, must be between 0 (bad) and 100 (good)
0638      * @return the post job for this voting
0639      */
0640     PostJob *voteForContent(const QString &contentId, uint rating);
0641 
0642     ItemPostJob<Content> *addNewContent(const Category &category, const Content &newContent);
0643     ItemPostJob<Content> *editContent(const Category &updatedCategory, const QString &contentId, const Content &updatedContent);
0644     PostJob *deleteContent(const QString &contentId);
0645 
0646     PostJob *setDownloadFile(const QString &contentId, const QString &fileName, QIODevice *payload);
0647     PostJob *setDownloadFile(const QString &contentId, const QString &fileName, const QByteArray &payload);
0648     PostJob *deleteDownloadFile(const QString &contentId);
0649 
0650     /**
0651      * Upload an image file as preview for the content
0652      * @param contentId
0653      * @param previewId each content can have previews with the id 1,2 or 3
0654      * @param payload the image file
0655      */
0656     PostJob *setPreviewImage(const QString &contentId, const QString &previewId, const QString &fileName, const QByteArray &image);
0657     PostJob *deletePreviewImage(const QString &contentId, const QString &previewId);
0658 
0659     // KnowledgeBase part of OCS
0660 
0661     ItemJob<KnowledgeBaseEntry> *requestKnowledgeBaseEntry(const QString &id);
0662     ListJob<KnowledgeBaseEntry> *searchKnowledgeBase(const Content &content, const QString &search, SortMode, int page, int pageSize);
0663 
0664     // Event part of OCS
0665 
0666     ItemJob<Event> *requestEvent(const QString &id);
0667     ListJob<Event> *requestEvent(const QString &country, const QString &search, const QDate &startAt, SortMode mode, int page, int pageSize);
0668 
0669     // Comment part of OCS
0670     /** Request a list of comments for a content / forum / knowledgebase / event.
0671      * @param comment::Type type of the comment @see Comment::Type (content / forum / knowledgebase / event)
0672      * @param id id of the content entry where you want to get the comments is from
0673      * @param id2 id of the content entry where you want to get the comments is from
0674      * @param page request nth page in the list of results
0675      * @param pageSize requested size of pages when calculating the list of results
0676      * @return list job for the comments results
0677      */
0678     ListJob<Comment> *requestComments(const Comment::Type commentType, const QString &id, const QString &id2, int page, int pageSize);
0679 
0680     /** Add a new comment.
0681      * @param commentType type of the comment @see CommentType (content / forum / knowledgebase / event)
0682      * @param id id of the content entry where you want to get the comments is from
0683      * @param id2 id of the sub content entry where you want to get the comments is from
0684      * @param parentId the id of the parent comment if the new comment is a reply
0685      * @param subject title of the comment
0686      * @param message text of the comment
0687      * @return item post job for adding the new comment
0688      */
0689     ItemPostJob<Comment> *addNewComment(const Comment::Type commentType,
0690                                         const QString &id,
0691                                         const QString &id2,
0692                                         const QString &parentId,
0693                                         const QString &subject,
0694                                         const QString &message);
0695 
0696     /** Vote a comment item
0697      * @param id the comment id which this voting is for
0698      * @param rating the rating, must be between 0 (bad) and 100 (good)
0699      * @return the post job for this voting
0700      */
0701     PostJob *voteForComment(const QString &id, uint rating);
0702 
0703     // Fan part of OCS
0704 
0705     PostJob *becomeFan(const QString &contentId);
0706     ListJob<Person> *requestFans(const QString &contentId, uint page = 0, uint pageSize = 10);
0707 
0708     // Forum part of OCS
0709     ListJob<Forum> *requestForums(uint page = 0, uint pageSize = 10);
0710     ListJob<Topic> *requestTopics(const QString &forum, const QString &search, const QString &description, SortMode mode, int page, int pageSize);
0711     PostJob *postTopic(const QString &forumId, const QString &subject, const QString &content);
0712 
0713     const QString &getRegisterAccountUrl() const;
0714 
0715 protected:
0716     QUrl createUrl(const QString &path);
0717     QNetworkRequest createRequest(const QUrl &url);
0718     // Convenience overload
0719     QNetworkRequest createRequest(const QString &path);
0720 
0721     ItemJob<Config> *doRequestConfig(const QUrl &url);
0722     ItemJob<Person> *doRequestPerson(const QUrl &url);
0723     ItemJob<AccountBalance> *doRequestAccountBalance(const QUrl &url);
0724     ListJob<Person> *doRequestPersonList(const QUrl &url);
0725     ListJob<Achievement> *doRequestAchievementList(const QUrl &url);
0726     ListJob<Activity> *doRequestActivityList(const QUrl &url);
0727     ListJob<Folder> *doRequestFolderList(const QUrl &url);
0728     ListJob<Forum> *doRequestForumList(const QUrl &url);
0729     ListJob<Topic> *doRequestTopicList(const QUrl &url);
0730     ListJob<Message> *doRequestMessageList(const QUrl &url);
0731 
0732 private:
0733     class Private;
0734     QExplicitlySharedDataPointer<Private> d;
0735 
0736     Provider(PlatformDependent *internals, const QUrl &baseUrl, const QString &name, const QUrl &icon = QUrl());
0737     Provider(PlatformDependent *internals,
0738              const QUrl &baseUrl,
0739              const QString &name,
0740              const QUrl &icon,
0741              const QString &person,
0742              const QString &friendV,
0743              const QString &message,
0744              const QString &achievements,
0745              const QString &activity,
0746              const QString &content,
0747              const QString &fan,
0748              const QString &forum,
0749              const QString &knowledgebase,
0750              const QString &event,
0751              const QString &comment);
0752     // kde-SC5: merge with the constructor above (i.e. remove the above one)
0753     Provider(PlatformDependent *internals,
0754              const QUrl &baseUrl,
0755              const QString &name,
0756              const QUrl &icon,
0757              const QString &person,
0758              const QString &friendV,
0759              const QString &message,
0760              const QString &achievements,
0761              const QString &activity,
0762              const QString &content,
0763              const QString &fan,
0764              const QString &forum,
0765              const QString &knowledgebase,
0766              const QString &event,
0767              const QString &comment,
0768              const QString &registerUrl);
0769     // TODO KF6: merge with the constructor above (i.e. remove the above one - and actually do it this time :P )
0770     Provider(PlatformDependent *internals,
0771              const QUrl &baseUrl,
0772              const QString &name,
0773              const QUrl &icon,
0774              const QString &person,
0775              const QString &friendV,
0776              const QString &message,
0777              const QString &achievements,
0778              const QString &activity,
0779              const QString &content,
0780              const QString &fan,
0781              const QString &forum,
0782              const QString &knowledgebase,
0783              const QString &event,
0784              const QString &comment,
0785              const QString &registerUrl,
0786              const QString &additionalAgentInformation);
0787 
0788     friend class ProviderManager;
0789 };
0790 }
0791 
0792 #endif