1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#ifndef ATTICA_PROVIDER_H
11#define ATTICA_PROVIDER_H
12
13#include <QExplicitlySharedDataPointer>
14#include <QSharedPointer>
15#include <QString>
16#include <QStringList>
17
18#include <QUrl>
19
20#include "achievement.h"
21#include "attica_export.h"
22#include "category.h"
23#include "comment.h"
24#include "distribution.h"
25#include "forum.h"
26#include "itemjob.h"
27#include "license.h"
28#include "listjob.h"
29#include "message.h"
30
31class QDate;
32class QUrl;
33
34namespace Attica
35{
36class PlatformDependent;
37
38class PostJobStatus;
39
40class AccountBalance;
41class Activity;
42class BuildServiceJobOutput;
43class BuildServiceJob;
44class BuildService;
45class PrivateData;
46class Config;
47class Content;
48class DownloadItem;
49class Distribution;
50class Event;
51class Folder;
52class HomePageType;
53class KnowledgeBaseEntry;
54class License;
55class Person;
56class PostJob;
57class Project;
58class Provider;
59class Publisher;
60class PublisherField;
61class RemoteAccount;
62
63/*!
64 * \class Attica::Provider
65 * \inheaderfile Attica/Provider
66 * \inmodule Attica
67 *
68 * \brief The Provider class represents one Open Collaboration Service provider.
69 *
70 * Use the ProviderManager to instantiate a Provider.
71 *
72 * Accessing functions of the Provider returns a Job class that
73 * takes care of accessing the server and parsing the result.
74 *
75 * Provider files are xml of the form:
76 * \badcode
77 * <provider>
78 * <id>opendesktop</id>
79 * <location>https://api.opendesktop.org/v1/</location>
80 * <name>openDesktop.org</name>
81 * <icon></icon>
82 * <termsofuse>https://opendesktop.org/terms/</termsofuse>
83 * <register>https://opendesktop.org/usermanager/new.php</register>
84 * <services>
85 * <person ocsversion="1.3" />
86 * <friend ocsversion="1.3" />
87 * <message ocsversion="1.3" />
88 * <activity ocsversion="1.3" />
89 * <content ocsversion="1.3" />
90 * <fan ocsversion="1.3" />
91 * <knowledgebase ocsversion="1.3" />
92 * <event ocsversion="1.3" />
93 * <comment ocsversion="1.2" />
94 * </services>
95 * </provider>
96 * \endcode
97 * The server provides the services specified in the services section, not necessarily all of them.
98 */
99class ATTICA_EXPORT Provider
100{
101public:
102 /*!
103 * Default construct a Provider. Please note that this provider is incomplete and never valid.
104 */
105 Provider();
106 Provider(const Provider &other);
107 Provider &operator=(const Provider &other);
108 ~Provider();
109
110 /*!
111 Returns true if the provider has been set up and can be used.
112 */
113 bool isValid() const;
114
115 /*!
116 Test if the provider is enabled by the settings.
117 The application can choose to ignore this, but the user settings should be respected.
118 */
119 bool isEnabled() const;
120
121 /*!
122 *
123 */
124 void setEnabled(bool enabled);
125
126 /*!
127 * Set a custom identifier for your application (sent along with the requests as
128 * the http agent header in addition to the application name and version).
129 *
130 * For example, you might have an application named SomeApplication, version 23,
131 * and wish to send along the data "lookandfeel.knsrc". Call this function, and
132 * the resulting agent header would be:
133 *
134 * SomeApplication/23 (+lookandfeel.knsrc)
135 *
136 * If you do not set this (or set it to an empty string), the agent string becomes
137 *
138 * SomeApplication/23
139 *
140 * \a additionalAgentInformation The extra string
141 * \since 5.66
142 */
143 void setAdditionalAgentInformation(const QString &additionalInformation);
144 /*!
145 * The custom identifier sent along with requests
146 *
147 * Returns the custom identifier
148 * \sa setAdditionalAgentInformation(const QString&)
149 * \since 5.66
150 */
151 QString additionalAgentInformation() const;
152
153 /*!
154 A url that identifies this provider.
155 This should be used as identifier when referring to this provider but you don't want to use the full provider object.
156 */
157 QUrl baseUrl() const;
158
159 /*!
160 A name for the provider that can be displayed to the user
161 */
162 QString name() const;
163
164 /*!
165 * An icon used to visually identify this provider
166 * Returns a URL for an icon image (or an invalid URL if one was not defined by the provider)
167 * \since 5.85
168 */
169 QUrl icon() const;
170
171 /*!
172 * \value Newest
173 * \value Alphabetical
174 * \value Rating
175 * \value Downloads
176 */
177 enum SortMode {
178 Newest,
179 Alphabetical,
180 Rating,
181 Downloads,
182 };
183
184 /*!
185 Test if the server supports the person part of the API
186 */
187 bool hasPersonService() const;
188 /*!
189 Version of the person part of the API
190 */
191 QString personServiceVersion() const;
192
193 /*!
194 Test if the server supports the friend part of the API
195 */
196 bool hasFriendService() const;
197
198 /*!
199 Version of the friend part of the API
200 */
201 QString friendServiceVersion() const;
202
203 /*!
204 Test if the server supports the message part of the API
205 */
206 bool hasMessageService() const;
207 /*!
208 Version of the message part of the API
209 */
210 QString messageServiceVersion() const;
211
212 /*!
213 Test if the server supports the achievement part of the API
214 */
215 bool hasAchievementService() const;
216 /*!
217 Version of the achievement part of the API
218 */
219 QString achievementServiceVersion() const;
220
221 /*!
222 Test if the server supports the activity part of the API
223 */
224 bool hasActivityService() const;
225 /*!
226 Version of the activity part of the API
227 */
228 QString activityServiceVersion() const;
229
230 /*!
231 Test if the server supports the content part of the API
232 */
233 bool hasContentService() const;
234 /*!
235 Version of the content part of the API
236 */
237 QString contentServiceVersion() const;
238
239 /*!
240 Test if the server supports the fan part of the API
241 */
242 bool hasFanService() const;
243 /*!
244 Version of the fan part of the API
245 */
246 QString fanServiceVersion() const;
247
248 /*!
249 Test if the server supports the forum part of the API
250 */
251 bool hasForumService() const;
252 /*!
253 Version of the forum part of the API
254 */
255 QString forumServiceVersion() const;
256
257 /*!
258 *
259 Test if the server supports the knowledgebase part of the API
260 */
261 bool hasKnowledgebaseService() const;
262 /*!
263 Version of the knowledgebase part of the API
264 */
265 QString knowledgebaseServiceVersion() const;
266
267 /*!
268 Test if the server supports the comments part of the API
269 */
270 bool hasCommentService() const;
271 /*!
272 Version of the comments part of the API
273 */
274 QString commentServiceVersion() const;
275
276 /*!
277 Test if the provider has user name/password available.
278 This does not yet open kwallet in case the KDE plugin is used.
279 Returns true if the provider has login information
280 */
281 bool hasCredentials() const;
282 bool hasCredentials();
283
284 /*!
285 Load user name and password from the store.
286
287 Attica will remember the loaded values and use them from this point on.
288
289 \a user reference that returns the user name
290
291 \a password reference that returns the password
292
293 Returns if credentials could be loaded
294 */
295 bool loadCredentials(QString &user, QString &password);
296
297 /*!
298 Sets (and remembers) user name and password for this provider.
299
300 To remove the data an empty username should be passed.
301
302 \a user the user (login) name
303
304 \a password the password
305
306 Returns if credentials could be saved
307 */
308 bool saveCredentials(const QString &user, const QString &password);
309
310 /*!
311 Test if the server accepts the login/password.
312
313 This function does not actually set the credentials. Use saveCredentials for that purpose.
314
315 \a user the user (login) name
316
317 \a password the password
318
319 Returns the job that will contain the success of the login as metadata
320 */
321 PostJob *checkLogin(const QString &user, const QString &password);
322
323 /*!
324 * Fetches server config
325 * Returns The job responsible for fetching data
326 */
327 ItemJob<Config> *requestConfig();
328
329 // Person part of OCS
330
331 /*!
332 *
333 */
334 PostJob *registerAccount(const QString &id, const QString &password, const QString &mail, const QString &firstName, const QString &lastName);
335
336 /*!
337 *
338 */
339 ItemJob<Person> *requestPerson(const QString &id);
340
341 /*!
342 *
343 */
344 ItemJob<Person> *requestPersonSelf();
345
346 /*!
347 *
348 */
349 ItemJob<AccountBalance> *requestAccountBalance();
350
351 /*!
352 *
353 */
354 ListJob<Person> *requestPersonSearchByName(const QString &name);
355
356 /*!
357 *
358 */
359 ListJob<Person> *requestPersonSearchByLocation(qreal latitude, qreal longitude, qreal distance = 0.0, int page = 0, int pageSize = 20);
360
361 /*!
362 *
363 */
364 PostJob *postLocation(qreal latitude, qreal longitude, const QString &city = QString(), const QString &country = QString());
365
366 //////////////////////////
367 // PrivateData part of OCS
368
369 /*!
370 * Fetches the a given attribute from an OCS-compliant server.
371 *
372 * \a app The application name
373 *
374 * \a key The key of the attribute to fetch (optional)
375 *
376 * Returns The job that is responsible for fetching the data
377 */
378 ItemJob<PrivateData> *requestPrivateData(const QString &app, const QString &key = QString());
379
380 /*!
381 * Fetches all stored private data.
382 *
383 * Returns The job responsible for fetching data
384 */
385 ItemJob<PrivateData> *requestPrivateData()
386 {
387 return requestPrivateData(app: QString(), key: QString());
388 }
389
390 /*!
391 * Sets the value of an attribute.
392 *
393 * \a app The application name
394 *
395 * \a key The key of the attribute
396 *
397 * \a value The new value of the attribute
398 *
399 * Returns The job responsible for setting data
400 */
401 PostJob *setPrivateData(const QString &app, const QString &key, const QString &value);
402
403 // Friend part of OCS
404
405 /*!
406 *
407 */
408 ListJob<Person> *requestFriends(const QString &id, int page = 0, int pageSize = 20);
409
410 /*!
411 *
412 */
413 ListJob<Person> *requestSentInvitations(int page = 0, int pageSize = 20);
414
415 /*!
416 *
417 */
418 ListJob<Person> *requestReceivedInvitations(int page = 0, int pageSize = 20);
419
420 /*!
421 *
422 */
423 PostJob *inviteFriend(const QString &to, const QString &message);
424
425 /*!
426 *
427 */
428 PostJob *approveFriendship(const QString &to);
429
430 /*!
431 *
432 */
433 PostJob *declineFriendship(const QString &to);
434
435 /*!
436 *
437 */
438 PostJob *cancelFriendship(const QString &to);
439
440 // Message part of OCS
441
442 /*!
443 *
444 */
445 ListJob<Folder> *requestFolders();
446
447 /*!
448 *
449 */
450 ListJob<Message> *requestMessages(const Folder &folder);
451
452 /*!
453 *
454 */
455 ListJob<Message> *requestMessages(const Folder &folder, Message::Status status);
456
457 /*!
458 *
459 */
460 ItemJob<Message> *requestMessage(const Folder &folder, const QString &id);
461
462 /*!
463 *
464 */
465 PostJob *postMessage(const Message &message);
466
467 // Achievement part of OCS
468 /*!
469 * Get a list of achievements
470 * Returns ListJob listing Achievements
471 */
472 ListJob<Achievement> *requestAchievements(const QString &contentId, const QString &achievementId, const QString &userId);
473
474 /*! Add a new achievement.
475 *
476 * \a id id of the achievement entry
477 *
478 * \a achievement The new Achievement added
479 *
480 * Returns item post job for adding the new achievement
481 */
482 ItemPostJob<Achievement> *addNewAchievement(const QString &id, const Achievement &newAchievement);
483
484 /*!
485 * Post modifications to an Achievement on the server
486 *
487 * \a achievement Achievement to update on the server
488 */
489 PutJob *editAchievement(const QString &contentId, const QString &achievementId, const Achievement &achievement);
490
491 /*!
492 * Deletes an achievement on the server. The achievement passed as an argument doesn't need complete
493 * information as just the id() is used.
494 *
495 * \a achievementId Achievement to delete on the server.
496 */
497 DeleteJob *deleteAchievement(const QString &contentId, const QString &achievementId);
498
499 // PostJob* postAchievement(const Achievement& achievement);
500
501 /*!
502 *
503 */
504 PostJob *setAchievementProgress(const QString &id, const QVariant &progress, const QDateTime &timestamp);
505
506 /*!
507 *
508 */
509 DeleteJob *resetAchievementProgress(const QString &id);
510
511 // Activity part of OCS
512
513 /*!
514 *
515 */
516 ListJob<Activity> *requestActivities();
517
518 /*!
519 *
520 */
521 PostJob *postActivity(const QString &message);
522
523 // Project part of OCS
524 /*!
525 * Get a list of build service projects
526 * Returns ListJob listing Projects
527 */
528 ListJob<Project> *requestProjects();
529
530 /*!
531 * Get a Project's data
532 * Returns ItemJob receiving data
533 */
534 ItemJob<Project> *requestProject(const QString &id);
535
536 /*!
537 * Post modifications to a Project on the server. The resulting project ID can be found in
538 * the Attica::MetaData of the finished() PostJob. You can retrieve it using
539 * Attica::MetaData::resultingProjectId().
540 *
541 * \a project Project to create on the server
542 */
543 PostJob *createProject(const Project &project);
544
545 /*!
546 * Deletes a project on the server. The project passed as an argument doesn't need complete
547 * information as just the id() is used.
548 *
549 * \a project Project to delete on the server.
550 */
551 PostJob *deleteProject(const Project &project);
552
553 /*!
554 * Post modifications to a Project on the server
555 *
556 * \a project Project to update on the server
557 */
558 PostJob *editProject(const Project &project);
559
560 // Buildservice part of OCS
561
562 /*!
563 * Get the information for a specific build service instance.
564 * Returns ItemJob receiving data
565 */
566 ItemJob<BuildService> *requestBuildService(const QString &id);
567
568 /*!
569 * Get the information for a specific publisher.
570 * Returns ItemJob receiving data
571 */
572 ItemJob<Publisher> *requestPublisher(const QString &id);
573
574 /*!
575 * Save the value of a single publishing field
576 * Returns PostJob*
577 */
578 PostJob *savePublisherField(const Project &project, const PublisherField &field);
579
580 /*!
581 * Publish the result of a completed build job to a publisher.
582 * Returns ItemJob receiving data
583 */
584 PostJob *publishBuildJob(const BuildServiceJob &buildjob, const Publisher &publisher);
585
586 /*!
587 * Get the build output for a specific build service job
588 * Returns ItemJob receiving and containing the output data
589 */
590 ItemJob<BuildServiceJobOutput> *requestBuildServiceJobOutput(const QString &id);
591
592 /*!
593 * Get the information for a specific build service job, such as status and progress.
594 * Returns ItemJob receiving and containing the data
595 */
596 ItemJob<BuildServiceJob> *requestBuildServiceJob(const QString &id);
597
598 /*!
599 * Get a list of build service build services
600 * Returns ListJob listing BuildServices
601 */
602 ListJob<BuildService> *requestBuildServices();
603
604 /*!
605 * Get a list of publishers
606 * Returns ListJob listing Publishers
607 */
608 ListJob<Publisher> *requestPublishers();
609
610 /*!
611 * Get a list of build service projects
612 * Returns ListJob listing BuildServiceJobs
613 */
614 ListJob<BuildServiceJob> *requestBuildServiceJobs(const Project &project);
615
616 /*!
617 * Create a new job for a given project on a given buildservice for a given target.
618 * Those three items are mandatory for the job to succeed.
619 *
620 * \a job Buildservicejob to create on the server
621 */
622 PostJob *createBuildServiceJob(const BuildServiceJob &job);
623
624 /*!
625 * Cancel a job.
626 * Setting the ID on the build service parameter is enough for it to work.
627 *
628 * \a job Buildservicejob to cancel on the server, needs at least id set.
629 */
630 PostJob *cancelBuildServiceJob(const BuildServiceJob &job);
631
632 /*!
633 * Get a list of remote accounts, account for a build service instance
634 * which is stored in the OCS service in order to authenticate with the
635 * build service instance.
636 * Returns ListJob listing RemoteAccounts
637 */
638 ListJob<RemoteAccount> *requestRemoteAccounts();
639
640 /*!
641 * Deletes a remote account stored on the OCS server.
642 *
643 * \a id The ID of the remote account on the OCS instance.
644 */
645 PostJob *deleteRemoteAccount(const QString &id);
646
647 /*!
648 * Create a new remote account, an account for a build service instance
649 * which is stored in the OCS service in order to authenticate with the
650 * build service instance.
651 * Type, Type ID, login and password are mandatory.
652 *
653 * \a account RemoteAccount to create on the server
654 */
655 PostJob *createRemoteAccount(const RemoteAccount &account);
656
657 /*!
658 * Edit an existing remote account.
659 *
660 * \a account RemoteAccount to create on the server
661 */
662 PostJob *editRemoteAccount(const RemoteAccount &account);
663
664 /*! Get a remote account by its ID.
665 *
666 * \a id The ID of the remote account
667 */
668 ItemJob<RemoteAccount> *requestRemoteAccount(const QString &id);
669
670 /*! Upload a tarball to the buildservice.
671 *
672 * \a projectId The ID of the project this source file belongs to
673 *
674 * \a payload A reference to the complete file data
675 *
676 * Returns A postjob to keep keep track of the upload
677 */
678 Attica::PostJob *uploadTarballToBuildService(const QString &projectId, const QString &fileName, const QByteArray &payload);
679
680 // Content part of OCS
681
682 /*!
683 * Get a list of categories (such as wallpaper)
684 * Returns the categories of the server
685 */
686 ListJob<Category> *requestCategories();
687
688 /*!
689 * Get a list of licenses (such as GPL)
690 * Returns the licenses available from the server
691 */
692 ListJob<License> *requestLicenses();
693
694 /*!
695 * Get a list of distributions (such as Ark, Debian)
696 * Returns the licenses available from the server
697 */
698 ListJob<Distribution> *requestDistributions();
699
700 /*!
701 * Get a list of home page types (such as blog, Facebook)
702 * Returns the licenses available from the server
703 */
704 ListJob<HomePageType> *requestHomePageTypes();
705
706 /*!
707 Request a list of Contents.
708
709 Note that \a categories is not optional. If left empty, no results will be returned.
710
711 An empty search string \a search returns the top n items.
712
713 \a categories categories to search in
714
715 \a search optional search string (in name/description of the content)
716
717 \a mode sorting mode
718
719 \a page request nth page in the list of results
720
721 \a pageSize requested size of pages when calculating the list of results
722
723 Returns list job for the search results
724 */
725 ListJob<Content> *
726 searchContents(const Category::List &categories, const QString &search = QString(), SortMode mode = Rating, uint page = 0, uint pageSize = 10);
727
728 /*!
729 Request a list of Contents.
730
731 Like searchContents, but only contents created by one person.
732
733 \a person the person-id that created the contents.
734 */
735 ListJob<Content> *searchContentsByPerson(const Category::List &categories,
736 const QString &person,
737 const QString &search = QString(),
738 SortMode mode = Rating,
739 uint page = 0,
740 uint pageSize = 10);
741
742 /*!
743 Request a list of Contents. More complete version.
744
745 Note that \a categories is not optional. If left empty, no results will be returned.
746
747 An empty search string \a search returns the top n items.
748
749 \a categories categories to search in
750
751 \a person the person-id that created the contents
752
753 \a distributions list of distributions to filter by, if empty no filtering by distribution is done
754
755 \a licenses list of licenses to filter by, if empty no filtering by license is done
756
757 \a search optional search string (in name/description of the content)
758
759 \a mode sorting mode
760
761 \a page request nth page in the list of results
762
763 \a pageSize requested size of pages when calculating the list of results
764
765 Returns list job for the search results
766 */
767 ListJob<Content> *searchContents(const Category::List &categories,
768 const QString &person,
769 const Distribution::List &distributions,
770 const License::List &licenses,
771 const QString &search = QString(),
772 SortMode sortMode = Rating,
773 uint page = 0,
774 uint pageSize = 10);
775
776 /*!
777 Retrieve a single content.
778
779 \a contentId the id of the content
780
781 Returns job that retrieves the content object
782 */
783 ItemJob<Content> *requestContent(const QString &contentId);
784
785 /*!
786 *
787 */
788 ItemJob<DownloadItem> *downloadLink(const QString &contentId, const QString &itemId = QStringLiteral("1"));
789
790 /*! Vote for a content item
791 *
792 * \a contentId the content which this voting is for
793 *
794 * \a rating - the rating, must be between 0 (bad) and 100 (good)
795 *
796 * Returns the post job for this voting
797 */
798 PostJob *voteForContent(const QString &contentId, uint rating);
799
800 /*!
801 *
802 */
803 ItemPostJob<Content> *addNewContent(const Category &category, const Content &newContent);
804
805 /*!
806 *
807 */
808 ItemPostJob<Content> *editContent(const Category &updatedCategory, const QString &contentId, const Content &updatedContent);
809
810 /*!
811 *
812 */
813 PostJob *deleteContent(const QString &contentId);
814
815 /*!
816 *
817 */
818 PostJob *setDownloadFile(const QString &contentId, const QString &fileName, QIODevice *payload);
819
820 /*!
821 *
822 */
823 PostJob *setDownloadFile(const QString &contentId, const QString &fileName, const QByteArray &payload);
824
825 /*!
826 *
827 */
828 PostJob *deleteDownloadFile(const QString &contentId);
829
830 /*!
831 * Upload an image file as preview for the content
832 *
833 * \a contentId
834 *
835 * \a previewId each content can have previews with the id 1,2 or 3
836 *
837 * \a payload the image file
838 */
839 PostJob *setPreviewImage(const QString &contentId, const QString &previewId, const QString &fileName, const QByteArray &image);
840
841 /*!
842 *
843 */
844 PostJob *deletePreviewImage(const QString &contentId, const QString &previewId);
845
846 // KnowledgeBase part of OCS
847
848 /*!
849 *
850 */
851 ItemJob<KnowledgeBaseEntry> *requestKnowledgeBaseEntry(const QString &id);
852
853 /*!
854 *
855 */
856 ListJob<KnowledgeBaseEntry> *searchKnowledgeBase(const Content &content, const QString &search, SortMode, int page, int pageSize);
857
858 // Event part of OCS
859
860 /*!
861 *
862 */
863 ItemJob<Event> *requestEvent(const QString &id);
864
865 /*!
866 *
867 */
868 ListJob<Event> *requestEvent(const QString &country, const QString &search, const QDate &startAt, SortMode mode, int page, int pageSize);
869
870 // Comment part of OCS
871 /*! Request a list of comments for a content / forum / knowledgebase / event.
872 *
873 * \a type of the comment Comment::Type (content / forum / knowledgebase / event)
874 *
875 * \a id id of the content entry where you want to get the comments is from
876 *
877 * \a id2 id of the content entry where you want to get the comments is from
878 *
879 * \a page request nth page in the list of results
880 *
881 * \a pageSize requested size of pages when calculating the list of results
882 *
883 * Returns list job for the comments results
884 */
885 ListJob<Comment> *requestComments(const Comment::Type commentType, const QString &id, const QString &id2, int page, int pageSize);
886
887 /*! Add a new comment.
888 *
889 * \a commentType type of the comment CommentType (content / forum / knowledgebase / event)
890 *
891 * \a id id of the content entry where you want to get the comments is from
892 *
893 * \a id2 id of the sub content entry where you want to get the comments is from
894 *
895 * \a parentId the id of the parent comment if the new comment is a reply
896 *
897 * \a subject title of the comment
898 *
899 * \a message text of the comment
900 *
901 * Returns item post job for adding the new comment
902 */
903 ItemPostJob<Comment> *addNewComment(const Comment::Type commentType,
904 const QString &id,
905 const QString &id2,
906 const QString &parentId,
907 const QString &subject,
908 const QString &message);
909
910 /*! Vote a comment item
911 *
912 * \a id the comment id which this voting is for
913 *
914 * \a rating the rating, must be between 0 (bad) and 100 (good)
915 *
916 * Returns the post job for this voting
917 */
918 PostJob *voteForComment(const QString &id, uint rating);
919
920 // Fan part of OCS
921
922 /*!
923 *
924 */
925 PostJob *becomeFan(const QString &contentId);
926
927 /*!
928 *
929 */
930 ListJob<Person> *requestFans(const QString &contentId, uint page = 0, uint pageSize = 10);
931
932 // Forum part of OCS
933 /*!
934 *
935 */
936 ListJob<Forum> *requestForums(uint page = 0, uint pageSize = 10);
937
938 /*!
939 *
940 */
941 ListJob<Topic> *requestTopics(const QString &forum, const QString &search, const QString &description, SortMode mode, int page, int pageSize);
942
943 /*!
944 *
945 */
946 PostJob *postTopic(const QString &forumId, const QString &subject, const QString &content);
947
948 /*!
949 *
950 */
951 const QString &getRegisterAccountUrl() const;
952
953protected:
954 QUrl createUrl(const QString &path);
955 QNetworkRequest createRequest(const QUrl &url);
956 // Convenience overload
957 QNetworkRequest createRequest(const QString &path);
958
959 ItemJob<Config> *doRequestConfig(const QUrl &url);
960 ItemJob<Person> *doRequestPerson(const QUrl &url);
961 ItemJob<AccountBalance> *doRequestAccountBalance(const QUrl &url);
962 ListJob<Person> *doRequestPersonList(const QUrl &url);
963 ListJob<Achievement> *doRequestAchievementList(const QUrl &url);
964 ListJob<Activity> *doRequestActivityList(const QUrl &url);
965 ListJob<Folder> *doRequestFolderList(const QUrl &url);
966 ListJob<Forum> *doRequestForumList(const QUrl &url);
967 ListJob<Topic> *doRequestTopicList(const QUrl &url);
968 ListJob<Message> *doRequestMessageList(const QUrl &url);
969
970private:
971 class Private;
972 QExplicitlySharedDataPointer<Private> d;
973
974 Provider(PlatformDependent *internals, const QUrl &baseUrl, const QString &name, const QUrl &icon = QUrl());
975 Provider(PlatformDependent *internals,
976 const QUrl &baseUrl,
977 const QString &name,
978 const QUrl &icon,
979 const QString &person,
980 const QString &friendV,
981 const QString &message,
982 const QString &achievements,
983 const QString &activity,
984 const QString &content,
985 const QString &fan,
986 const QString &forum,
987 const QString &knowledgebase,
988 const QString &event,
989 const QString &comment);
990 // kde-SC5: merge with the constructor above (i.e. remove the above one)
991 Provider(PlatformDependent *internals,
992 const QUrl &baseUrl,
993 const QString &name,
994 const QUrl &icon,
995 const QString &person,
996 const QString &friendV,
997 const QString &message,
998 const QString &achievements,
999 const QString &activity,
1000 const QString &content,
1001 const QString &fan,
1002 const QString &forum,
1003 const QString &knowledgebase,
1004 const QString &event,
1005 const QString &comment,
1006 const QString &registerUrl);
1007 // TODO KF6: merge with the constructor above (i.e. remove the above one - and actually do it this time :P )
1008 Provider(PlatformDependent *internals,
1009 const QUrl &baseUrl,
1010 const QString &name,
1011 const QUrl &icon,
1012 const QString &person,
1013 const QString &friendV,
1014 const QString &message,
1015 const QString &achievements,
1016 const QString &activity,
1017 const QString &content,
1018 const QString &fan,
1019 const QString &forum,
1020 const QString &knowledgebase,
1021 const QString &event,
1022 const QString &comment,
1023 const QString &registerUrl,
1024 const QString &additionalAgentInformation);
1025
1026 friend class ProviderManager;
1027};
1028}
1029
1030#endif
1031

source code of attica/src/provider.h