10#ifndef ATTICA_PROVIDER_H
11#define ATTICA_PROVIDER_H
13#include <QExplicitlySharedDataPointer>
14#include <QSharedPointer>
20#include "achievement.h"
21#include "attica_export.h"
24#include "distribution.h"
36class PlatformDependent;
42class BuildServiceJobOutput;
53class KnowledgeBaseEntry;
114 void setEnabled(
bool enabled);
266 bool hasCredentials();
303 PostJob *registerAccount(
const QString &
id,
const QString &password,
const QString &mail,
const QString &firstName,
const QString &lastName);
308 ListJob<Person> *requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance = 0.0,
int page = 0,
int pageSize = 20);
309 PostJob *postLocation(qreal latitude, qreal longitude,
const QString &city = QString(),
const QString &country = QString());
328 return requestPrivateData(QString(), QString());
342 ListJob<Person> *requestFriends(
const QString &
id,
int page = 0,
int pageSize = 20);
343 ListJob<Person> *requestSentInvitations(
int page = 0,
int pageSize = 20);
344 ListJob<Person> *requestReceivedInvitations(
int page = 0,
int pageSize = 20);
345 PostJob *inviteFriend(
const QString &to,
const QString &message);
346 PostJob *approveFriendship(
const QString &to);
347 PostJob *declineFriendship(
const QString &to);
348 PostJob *cancelFriendship(
const QString &to);
386 PostJob *setAchievementProgress(
const QString &
id,
const QVariant &progress,
const QDateTime ×tamp);
387 DeleteJob *resetAchievementProgress(
const QString &
id);
392 PostJob *postActivity(
const QString &message);
577 searchContents(
const Category::List &categories,
const QString &search = QString(), SortMode mode = Rating, uint page = 0, uint pageSize = 10);
585 const QString &person,
586 const QString &search = QString(),
587 SortMode mode = Rating,
606 const QString &person,
607 const Distribution::List &distributions,
608 const License::List &licenses,
609 const QString &search = QString(),
610 SortMode sortMode = Rating,
621 ItemJob<DownloadItem> *downloadLink(
const QString &contentId,
const QString &itemId = QStringLiteral(
"1"));
623#if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2)
631 ATTICA_DEPRECATED_VERSION(0, 2,
"Use Provider::voteForContent(const QString &, uint)")
632 PostJob *voteForContent(const QString &contentId,
bool positiveVote);
644 PostJob *deleteContent(
const QString &contentId);
646 PostJob *setDownloadFile(
const QString &contentId,
const QString &fileName, QIODevice *payload);
647 PostJob *setDownloadFile(
const QString &contentId,
const QString &fileName,
const QByteArray &payload);
648 PostJob *deleteDownloadFile(
const QString &contentId);
656 PostJob *
setPreviewImage(
const QString &contentId,
const QString &previewId,
const QString &fileName,
const QByteArray &image);
657 PostJob *deletePreviewImage(
const QString &contentId,
const QString &previewId);
667 ListJob<Event> *requestEvent(
const QString &country,
const QString &search,
const QDate &startAt, SortMode mode,
int page,
int pageSize);
692 const QString &parentId,
693 const QString &subject,
694 const QString &message);
705 PostJob *becomeFan(
const QString &contentId);
706 ListJob<Person> *requestFans(
const QString &contentId, uint page = 0, uint pageSize = 10);
710 ListJob<Topic> *requestTopics(
const QString &forum,
const QString &search,
const QString &description, SortMode mode,
int page,
int pageSize);
711 PostJob *postTopic(
const QString &forumId,
const QString &subject,
const QString &content);
713 const QString &getRegisterAccountUrl()
const;
716 QUrl createUrl(
const QString &path);
717 QNetworkRequest createRequest(
const QUrl &url);
719 QNetworkRequest createRequest(
const QString &path);
734 QExplicitlySharedDataPointer<Private> d;
736 Provider(PlatformDependent *internals,
const QUrl &baseUrl,
const QString &name,
const QUrl &icon = QUrl());
737 Provider(PlatformDependent *internals,
741 const QString &person,
742 const QString &friendV,
743 const QString &message,
744 const QString &achievements,
745 const QString &activity,
746 const QString &content,
748 const QString &forum,
749 const QString &knowledgebase,
750 const QString &event,
751 const QString &comment);
753 Provider(PlatformDependent *internals,
757 const QString &person,
758 const QString &friendV,
759 const QString &message,
760 const QString &achievements,
761 const QString &activity,
762 const QString &content,
764 const QString &forum,
765 const QString &knowledgebase,
766 const QString &event,
767 const QString &comment,
768 const QString ®isterUrl);
770 Provider(PlatformDependent *internals,
774 const QString &person,
775 const QString &friendV,
776 const QString &message,
777 const QString &achievements,
778 const QString &activity,
779 const QString &content,
781 const QString &forum,
782 const QString &knowledgebase,
783 const QString &event,
784 const QString &comment,
785 const QString ®isterUrl,
786 const QString &additionalAgentInformation);
Represents an achievement.
Definition achievement.h:28
Represents a build service job.
Definition buildservicejob.h:29
Represents a single content category.
Definition category.h:24
Represents a single content.
Definition content.h:33
Represents a delete job.
Definition deletejob.h:26
Represents a single mail folder.
Definition folder.h:25
Represents an item get job.
Definition itemjob.h:30
Represents an item post job.
Definition itemjob.h:66
Represents a list job.
Definition listjob.h:28
Represents a message.
Definition message.h:27
Represents a post job.
Definition postjob.h:30
Represents a project.
Definition project.h:30
Attica ProviderManager.
Definition providermanager.h:60
The Provider class represents one Open Collaboration Service provider.
Definition provider.h:97
PostJob * savePublisherField(const Project &project, const PublisherField &field)
Save the value of a single publishing field.
ListJob< RemoteAccount > * requestRemoteAccounts()
Get a list of remote accounts, account for a build service instance which is stored in the OCS servic...
ItemPostJob< Comment > * addNewComment(const Comment::Type commentType, const QString &id, const QString &id2, const QString &parentId, const QString &subject, const QString &message)
Add a new comment.
Attica::PostJob * uploadTarballToBuildService(const QString &projectId, const QString &fileName, const QByteArray &payload)
Upload a tarball to the buildservice.
bool hasCredentials() const
Test if the provider has user name/password available.
ListJob< HomePageType > * requestHomePageTypes()
Get a list of home page types (such as blog, Facebook)
QString achievementServiceVersion() const
Version of the achievement part of the API.
bool hasAchievementService() const
Test if the server supports the achievement part of the API.
ListJob< Content > * searchContents(const Category::List &categories, const QString &person, const Distribution::List &distributions, const License::List &licenses, const QString &search=QString(), SortMode sortMode=Rating, uint page=0, uint pageSize=10)
Request a list of Contents.
PostJob * publishBuildJob(const BuildServiceJob &buildjob, const Publisher &publisher)
Publish the result of a completed build job to a publisher.
bool hasFriendService() const
Test if the server supports the friend part of the API.
ListJob< Content > * searchContents(const Category::List &categories, const QString &search=QString(), SortMode mode=Rating, uint page=0, uint pageSize=10)
Request a list of Contents.
bool hasActivityService() const
Test if the server supports the activity part of the API.
void setAdditionalAgentInformation(const QString &additionalInformation)
Set a custom identifier for your application (sent along with the requests as the http agent header i...
QString messageServiceVersion() const
Version of the message part of the API.
QString friendServiceVersion() const
Version of the friend part of the API.
bool loadCredentials(QString &user, QString &password)
Load user name and password from the store.
bool hasCommentService() const
Test if the server supports the comments part of the API.
QString fanServiceVersion() const
Version of the fan part of the API.
bool hasKnowledgebaseService() const
Test if the server supports the knowledgebase part of the API.
bool saveCredentials(const QString &user, const QString &password)
Sets (and remembers) user name and password for this provider.
bool hasFanService() const
Test if the server supports the fan part of the API.
PutJob * editAchievement(const QString &contentId, const QString &achievementId, const Achievement &achievement)
Post modifications to an Achievement on the server.
DeleteJob * deleteAchievement(const QString &contentId, const QString &achievementId)
Deletes an achievement on the server.
bool hasContentService() const
Test if the server supports the content part of the API.
ListJob< Achievement > * requestAchievements(const QString &contentId, const QString &achievementId, const QString &userId)
Get a list of achievements.
QString forumServiceVersion() const
Version of the forum part of the API.
PostJob * checkLogin(const QString &user, const QString &password)
Test if the server accepts the login/password.
ListJob< Project > * requestProjects()
Get a list of build service projects.
ItemJob< BuildServiceJob > * requestBuildServiceJob(const QString &id)
Get the information for a specific build service job, such as status and progress.
ItemJob< BuildService > * requestBuildService(const QString &id)
Get the information for a specific build service instance.
ListJob< License > * requestLicenses()
Get a list of licenses (such as GPL)
PostJob * createRemoteAccount(const RemoteAccount &account)
Create a new remote account, an account for a build service instance which is stored in the OCS servi...
QString name() const
A name for the provider that can be displayed to the user.
bool hasForumService() const
Test if the server supports the forum part of the API.
ItemJob< BuildServiceJobOutput > * requestBuildServiceJobOutput(const QString &id)
Get the build output for a specific build service job.
QString personServiceVersion() const
Version of the person part of the API.
ItemJob< Config > * requestConfig()
Fetches server config.
bool hasMessageService() const
Test if the server supports the message part of the API.
QUrl baseUrl() const
A url that identifies this provider.
QString additionalAgentInformation() const
The custom identifier sent along with requests.
ListJob< Content > * searchContentsByPerson(const Category::List &categories, const QString &person, const QString &search=QString(), SortMode mode=Rating, uint page=0, uint pageSize=10)
Request a list of Contents.
ListJob< Distribution > * requestDistributions()
Get a list of distributions (such as Ark, Debian)
PostJob * cancelBuildServiceJob(const BuildServiceJob &job)
Cancel a job.
ListJob< Category > * requestCategories()
Get a list of categories (such as wallpaper)
PostJob * createBuildServiceJob(const BuildServiceJob &job)
Create a new job for a given project on a given buildservice for a given target.
PostJob * editProject(const Project &project)
Post modifications to a Project on the server.
PostJob * createProject(const Project &project)
Post modifications to a Project on the server.
ListJob< BuildService > * requestBuildServices()
Get a list of build service build services.
PostJob * deleteProject(const Project &project)
Deletes a project on the server.
PostJob * editRemoteAccount(const RemoteAccount &account)
Edit an existing remote account.
bool isEnabled() const
Test if the provider is enabled by the settings.
ListJob< Comment > * requestComments(const Comment::Type commentType, const QString &id, const QString &id2, int page, int pageSize)
Request a list of comments for a content / forum / knowledgebase / event.
ItemJob< Content > * requestContent(const QString &contentId)
Retrieve a single content.
PostJob * setPrivateData(const QString &app, const QString &key, const QString &value)
Sets the value of an attribute.
bool isValid() const
Returns true if the provider has been set up and can be used.
ItemJob< PrivateData > * requestPrivateData(const QString &app, const QString &key=QString())
Fetches the a given attribute from an OCS-compliant server.
ItemPostJob< Achievement > * addNewAchievement(const QString &id, const Achievement &newAchievement)
Add a new achievement.
bool hasPersonService() const
Test if the server supports the person part of the API.
QString knowledgebaseServiceVersion() const
Version of the knowledgebase part of the API.
PostJob * voteForComment(const QString &id, uint rating)
Vote a comment item.
QString contentServiceVersion() const
Version of the content part of the API.
PostJob * deleteRemoteAccount(const QString &id)
Deletes a remote account stored on the OCS server.
ListJob< BuildServiceJob > * requestBuildServiceJobs(const Project &project)
Get a list of build service projects.
ItemJob< PrivateData > * requestPrivateData()
Fetches all stored private data.
Definition provider.h:326
ItemJob< Publisher > * requestPublisher(const QString &id)
Get the information for a specific publisher.
PostJob * voteForContent(const QString &contentId, uint rating)
Vote for a content item.
PostJob * setPreviewImage(const QString &contentId, const QString &previewId, const QString &fileName, const QByteArray &image)
Upload an image file as preview for the content.
ItemJob< Project > * requestProject(const QString &id)
Get a Project's data.
ListJob< Publisher > * requestPublishers()
Get a list of publishers.
QString commentServiceVersion() const
Version of the comments part of the API.
QString activityServiceVersion() const
Version of the activity part of the API.
ItemJob< RemoteAccount > * requestRemoteAccount(const QString &id)
Get a remote account by its ID.
QUrl icon() const
An icon used to visually identify this provider.
Represents a publisher field.
Definition publisherfield.h:24
Represents a publisher.
Definition publisher.h:44
Represents a put job.
Definition putjob.h:30
Represents a remote account.
Definition remoteaccount.h:30
The Attica namespace,.
Definition activity.h:21