PrivMX Endpoint v2.8.0
Loading...
Searching...
No Matches
InboxApi.hpp
1#ifndef _PRIVMXLIB_ENDPOINT_INBOX_INBOXAPI_HPP_
2#define _PRIVMXLIB_ENDPOINT_INBOX_INBOXAPI_HPP_
3
4#include <memory>
5#include <optional>
6#include <string>
7#include <vector>
8
9#include "privmx/endpoint/core/Connection.hpp"
10#include "privmx/endpoint/core/Types.hpp"
11
12#include "privmx/endpoint/inbox/Types.hpp"
13#include "privmx/endpoint/store/StoreApi.hpp"
14#include "privmx/endpoint/thread/ThreadApi.hpp"
15#include <privmx/endpoint/core/ExtendedPointer.hpp>
16
17namespace privmx {
18namespace endpoint {
19namespace inbox {
20
21class InboxApiImpl;
22
27public:
37 static InboxApi create(core::Connection& connection, thread::ThreadApi& threadApi, store::StoreApi& storeApi);
38
43 InboxApi(const InboxApi& obj);
44 InboxApi& operator=(const InboxApi& obj);
45 InboxApi(InboxApi&& obj);
46 ~InboxApi();
47
61 std::string createInbox(
62 const std::string& contextId,
63 const std::vector<core::UserWithPubKey>& users,
64 const std::vector<core::UserWithPubKey>& managers,
65 const core::Buffer& publicMeta,
66 const core::Buffer& privateMeta,
67 const std::optional<inbox::FilesConfig>& filesConfig,
68 const std::optional<core::ContainerPolicyWithoutItem>& policies = std::nullopt
69 );
70
87 const std::string& inboxId,
88 const std::vector<core::UserWithPubKey>& users,
89 const std::vector<core::UserWithPubKey>& managers,
90 const core::Buffer& publicMeta,
91 const core::Buffer& privateMeta,
92 const std::optional<inbox::FilesConfig>& filesConfig,
93 const int64_t version,
94 const bool force,
95 const bool forceGenerateNewKey,
96 const std::optional<core::ContainerPolicyWithoutItem>& policies = std::nullopt
97 );
98
105 Inbox getInbox(const std::string& inboxId);
106
114 core::PagingList<inbox::Inbox> listInboxes(const std::string& contextId, const core::PagingQuery& pagingQuery);
115
123 inbox::InboxPublicView getInboxPublicView(const std::string& inboxId);
124
130 void deleteInbox(const std::string& inboxId);
131
142 int64_t /*inboxHandle*/ prepareEntry(
143 const std::string& inboxId,
144 const core::Buffer& data,
145 const std::vector<int64_t>& inboxFileHandles = std::vector<int64_t>(),
146 const std::optional<std::string>& userPrivKey = std::nullopt
147 );
148
155 void sendEntry(const int64_t inboxHandle);
156
163 inbox::InboxEntry readEntry(const std::string& inboxEntryId);
164
172 core::PagingList<inbox::InboxEntry> listEntries(const std::string& inboxId, const core::PagingQuery& pagingQuery);
173
179 void deleteEntry(const std::string& inboxEntryId);
180
190 int64_t /*inboxFileHandle*/ createFileHandle(
191 const core::Buffer& publicMeta,
192 const core::Buffer& privateMeta,
193 const int64_t& fileSize
194 );
195
205 void writeToFile(const int64_t inboxHandle, const int64_t inboxFileHandle, const core::Buffer& dataChunk);
206
213 int64_t openFile(const std::string& fileId);
214
223 core::Buffer readFromFile(const int64_t fileHandle, const int64_t length);
224
231 void seekInFile(const int64_t fileHandle, const int64_t position);
232
239 std::string closeFile(const int64_t fileHandle);
240
247 std::vector<std::string> subscribeFor(const std::vector<std::string>& subscriptionQueries);
248
253 void unsubscribeFrom(const std::vector<std::string>& subscriptionIds);
254
262 EventType eventType,
263 EventSelectorType selectorType,
264 const std::string& selectorId
265 );
266
267private:
268 InboxApi(const std::shared_ptr<InboxApiImpl>& impl);
269};
270
271} // namespace inbox
272} // namespace endpoint
273} // namespace privmx
274
275#endif // _PRIVMXLIB_ENDPOINT_INBOX_INBOXAPI_HPP_
Definition Buffer.hpp:13
Definition Connection.hpp:21
Definition ExtendedPointer.hpp:16
int64_t prepareEntry(const std::string &inboxId, const core::Buffer &data, const std::vector< int64_t > &inboxFileHandles=std::vector< int64_t >(), const std::optional< std::string > &userPrivKey=std::nullopt)
std::string buildSubscriptionQuery(EventType eventType, EventSelectorType selectorType, const std::string &selectorId)
void unsubscribeFrom(const std::vector< std::string > &subscriptionIds)
static InboxApi create(core::Connection &connection, thread::ThreadApi &threadApi, store::StoreApi &storeApi)
core::Buffer readFromFile(const int64_t fileHandle, const int64_t length)
inbox::InboxEntry readEntry(const std::string &inboxEntryId)
std::string closeFile(const int64_t fileHandle)
void deleteEntry(const std::string &inboxEntryId)
void deleteInbox(const std::string &inboxId)
std::string createInbox(const std::string &contextId, const std::vector< core::UserWithPubKey > &users, const std::vector< core::UserWithPubKey > &managers, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const std::optional< inbox::FilesConfig > &filesConfig, const std::optional< core::ContainerPolicyWithoutItem > &policies=std::nullopt)
std::vector< std::string > subscribeFor(const std::vector< std::string > &subscriptionQueries)
core::PagingList< inbox::InboxEntry > listEntries(const std::string &inboxId, const core::PagingQuery &pagingQuery)
void sendEntry(const int64_t inboxHandle)
int64_t createFileHandle(const core::Buffer &publicMeta, const core::Buffer &privateMeta, const int64_t &fileSize)
Inbox getInbox(const std::string &inboxId)
void writeToFile(const int64_t inboxHandle, const int64_t inboxFileHandle, const core::Buffer &dataChunk)
void updateInbox(const std::string &inboxId, const std::vector< core::UserWithPubKey > &users, const std::vector< core::UserWithPubKey > &managers, const core::Buffer &publicMeta, const core::Buffer &privateMeta, const std::optional< inbox::FilesConfig > &filesConfig, const int64_t version, const bool force, const bool forceGenerateNewKey, const std::optional< core::ContainerPolicyWithoutItem > &policies=std::nullopt)
inbox::InboxPublicView getInboxPublicView(const std::string &inboxId)
int64_t openFile(const std::string &fileId)
void seekInFile(const int64_t fileHandle, const int64_t position)
core::PagingList< inbox::Inbox > listInboxes(const std::string &contextId, const core::PagingQuery &pagingQuery)
Definition StoreApi.hpp:22
Definition ThreadApi.hpp:23
Definition Types.hpp:16
Definition Types.hpp:139
Definition Types.hpp:59