vfs: check userland buffers before reading them.
[haiku.git] / src / apps / haikudepot / server / WebAppInterface.h
blob377ccf2f21b82fdd42214255584e753954a35dec
1 /*
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.
5 */
6 #ifndef WEB_APP_INTERFACE_H
7 #define WEB_APP_INTERFACE_H
10 #include <Application.h>
11 #include <String.h>
12 #include <package/PackageVersion.h>
14 #include "List.h"
17 class BDataIO;
18 class BMessage;
19 using BPackageKit::BPackageVersion;
21 typedef List<BString, false> StringList;
24 class WebAppInterface {
25 public:
26 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
35 { return fUsername; }
37 void SetPreferredLanguage(const BString& language);
38 void SetArchitecture(const BString& architecture);
40 status_t RetrieveRepositoriesForSourceBaseURLs(
41 const StringList& repositorySourceBaseURL,
42 BMessage& message);
44 status_t RetrievePackageInfo(
45 const BString& packageName,
46 const BString& architecture,
47 const BString& repositoryCode,
48 BMessage& message);
50 status_t RetrieveBulkPackageInfo(
51 const StringList& packageNames,
52 const StringList& packageArchitectures,
53 const StringList& repositoryCodes,
54 BMessage& message);
56 status_t RetrieveUserRatings(
57 const BString& packageName,
58 const BString& architecture,
59 int resultOffset, int maxResults,
60 BMessage& message);
62 status_t RetrieveUserRating(
63 const BString& packageName,
64 const BPackageVersion& version,
65 const BString& architecture,
66 const BString& repositoryCode,
67 const BString& username,
68 BMessage& message);
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,
77 int rating,
78 BMessage& message);
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,
86 BMessage& message);
88 status_t RetrieveScreenshot(
89 const BString& code,
90 int32 width, int32 height,
91 BDataIO* stream);
93 status_t RequestCaptcha(BMessage& message);
95 status_t CreateUser(const BString& nickName,
96 const BString& passwordClear,
97 const BString& email,
98 const BString& captchaToken,
99 const BString& captchaResponse,
100 const BString& languageCode,
101 BMessage& message);
103 status_t AuthenticateUser(const BString& nickName,
104 const BString& passwordClear,
105 BMessage& message);
107 private:
108 status_t _SendJsonRequest(const char* domain,
109 BString jsonString, uint32 flags,
110 BMessage& reply) const;
112 private:
113 BString fUsername;
114 BString fPassword;
115 BString fLanguage;
116 static int fRequestIndex;
120 #endif // WEB_APP_INTERFACE_H