2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3 * Copyright 2016-2017, Andrew Lindesay <apl@lindesay.co.nz>.
4 * All rights reserved. Distributed under the terms of the MIT License.
6 #ifndef WEB_APP_INTERFACE_H
7 #define WEB_APP_INTERFACE_H
10 #include <Application.h>
12 #include <package/PackageVersion.h>
19 using BPackageKit::BPackageVersion
;
21 typedef List
<BString
, false> StringList
;
24 class WebAppInterface
{
27 WebAppInterface(const WebAppInterface
& other
);
28 virtual ~WebAppInterface();
30 WebAppInterface
& operator=(const WebAppInterface
& other
);
32 void SetAuthorization(const BString
& username
,
33 const BString
& password
);
34 const BString
& Username() const
37 void SetPreferredLanguage(const BString
& language
);
38 void SetArchitecture(const BString
& architecture
);
40 status_t
RetrieveRepositoriesForSourceBaseURLs(
41 const StringList
& repositorySourceBaseURL
,
44 status_t
RetrievePackageInfo(
45 const BString
& packageName
,
46 const BString
& architecture
,
47 const BString
& repositoryCode
,
50 status_t
RetrieveBulkPackageInfo(
51 const StringList
& packageNames
,
52 const StringList
& packageArchitectures
,
53 const StringList
& repositoryCodes
,
56 status_t
RetrieveUserRatings(
57 const BString
& packageName
,
58 const BString
& architecture
,
59 int resultOffset
, int maxResults
,
62 status_t
RetrieveUserRating(
63 const BString
& packageName
,
64 const BPackageVersion
& version
,
65 const BString
& architecture
,
66 const BString
& repositoryCode
,
67 const BString
& username
,
70 status_t
CreateUserRating(
71 const BString
& packageName
,
72 const BString
& architecture
,
73 const BString
& repositoryCode
,
74 const BString
& languageCode
,
75 const BString
& comment
,
76 const BString
& stability
,
80 status_t
UpdateUserRating(
81 const BString
& ratingID
,
82 const BString
& languageCode
,
83 const BString
& comment
,
84 const BString
& stability
,
85 int rating
, bool active
,
88 status_t
RetrieveScreenshot(
90 int32 width
, int32 height
,
93 status_t
RequestCaptcha(BMessage
& message
);
95 status_t
CreateUser(const BString
& nickName
,
96 const BString
& passwordClear
,
98 const BString
& captchaToken
,
99 const BString
& captchaResponse
,
100 const BString
& languageCode
,
103 status_t
AuthenticateUser(const BString
& nickName
,
104 const BString
& passwordClear
,
108 status_t
_SendJsonRequest(const char* domain
,
109 BString jsonString
, uint32 flags
,
110 BMessage
& reply
) const;
116 static int fRequestIndex
;
120 #endif // WEB_APP_INTERFACE_H