mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-24 05:49:29 -04:00
Complete GxsChannels JSON API with blocking methods
RsGxsIfaceHelper::requestStatus expose it to JSON API Implemented RsGxsIfaceHelper::waitToken to wait for GXS operations RsItem::serial_process fix doxygen warning as it's a comment not documentation RsTypeSerializer add JSON conversion methods for double [de]serialization not implemented yet RsTypeSerializer_PRIVATE_{FROM,TO}_JSON_ARRAY fix doxygen warning as it's a comment not documentation make GxsChannels::ExtraFileHash a bit more reasonable jsonapi-generator fix unused variable warning if there is no input or output paramethers jsonapi-generator fix generation for inerithed jsonapi methods Convert to RsSerializable some Gxs structs for the JSON API
This commit is contained in:
parent
d731b665db
commit
15f39129f1
13 changed files with 316 additions and 82 deletions
|
@ -108,29 +108,83 @@ public:
|
|||
explicit RsGxsChannels(RsGxsIface& gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsGxsChannels() {}
|
||||
|
||||
/* Specific Service Data */
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups) = 0;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts) = 0;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts) = 0;
|
||||
//Not currently used
|
||||
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsGxsChannelPost> &posts) = 0;
|
||||
|
||||
/* From RsGxsCommentService */
|
||||
//virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
||||
//virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
||||
//virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
//virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
|
||||
virtual bool setChannelAutoDownload(const RsGxsGroupId &groupId, bool enabled) = 0;
|
||||
virtual bool getChannelAutoDownload(const RsGxsGroupId &groupid, bool& enabled) = 0;
|
||||
|
||||
virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std::string& directory)=0;
|
||||
/**
|
||||
* @brief Get channels summaries list. Blocking API.
|
||||
* @jsonapi{development}
|
||||
* @param[out] channels list where to store the channels
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getChannelsSummaries(std::list<RsGroupMetaData>& channels) = 0;
|
||||
|
||||
/**
|
||||
* Get download directory for the given channel
|
||||
* @brief Get channels information (description, thumbnail...).
|
||||
* Blocking API.
|
||||
* @jsonapi{development}
|
||||
* @param[in] chanIds ids of the channels of which to get the informations
|
||||
* @param[out] channelsInfo storage for the channels informations
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getChannelsInfo(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelGroup>& channelsInfo ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get content of specified channels. Blocking API
|
||||
* @jsonapi{development}
|
||||
* @param[in] chanIds id of the channels of which the content is requested
|
||||
* @param[out] posts storage for the posts
|
||||
* @param[out] comments storage for the comments
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getChannelsContent(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments ) = 0;
|
||||
|
||||
/* Specific Service Data
|
||||
* TODO: change the orrible const uint32_t &token to uint32_t token
|
||||
* TODO: create a new typedef for token so code is easier to read
|
||||
*/
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups) = 0;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts, std::vector<RsGxsComment> &cmts) = 0;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsGxsChannelPost> &posts) = 0;
|
||||
|
||||
|
||||
virtual void setMessageReadStatus(
|
||||
uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
|
||||
/**
|
||||
* @brief Enable or disable auto-download for given channel
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId channel id
|
||||
* @param[in] enable true to enable, false to disable
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool setChannelAutoDownload(
|
||||
const RsGxsGroupId &groupId, bool enable) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get auto-download option value for given channel
|
||||
* @jsonapi{development}
|
||||
* @param[in] groupId channel id
|
||||
* @param[in] enabled storage for the auto-download option value
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getChannelAutoDownload(
|
||||
const RsGxsGroupId &groupId, bool& enabled) = 0;
|
||||
|
||||
/**
|
||||
* @brief Set download directory for the given channel
|
||||
* @jsonapi{development}
|
||||
* @param[in] channelId id of the channel
|
||||
* @param[in] directory path
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool setChannelDownloadDirectory(
|
||||
const RsGxsGroupId& channelId, const std::string& directory) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get download directory for the given channel
|
||||
* @jsonapi{development}
|
||||
* @param[in] channelId id of the channel
|
||||
* @param[out] directory reference to string where to store the path
|
||||
|
@ -139,13 +193,16 @@ virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std:
|
|||
virtual bool getChannelDownloadDirectory( const RsGxsGroupId& channelId,
|
||||
std::string& directory ) = 0;
|
||||
|
||||
//virtual void setChannelAutoDownload(uint32_t& token, const RsGxsGroupId& groupId, bool autoDownload) = 0;
|
||||
|
||||
//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
|
||||
//virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
|
||||
|
||||
//virtual bool groupRestoreKeys(const std::string &groupId);
|
||||
virtual bool groupShareKeys(const RsGxsGroupId &groupId, std::set<RsPeerId>& peers)=0;
|
||||
/**
|
||||
* @brief Share channel publishing key
|
||||
* This can be used to authorize other peers to post on the channel
|
||||
* @jsonapi{development}
|
||||
* param[in] groupId Channel id
|
||||
* param[in] peers peers to which share the key
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool groupShareKeys(
|
||||
const RsGxsGroupId& groupId, const std::set<RsPeerId>& peers ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Request subscription to a group.
|
||||
|
@ -197,11 +254,22 @@ virtual bool setChannelDownloadDirectory(const RsGxsGroupId &groupId, const std:
|
|||
*/
|
||||
virtual bool updateGroup(uint32_t& token, RsGxsChannelGroup& group) = 0;
|
||||
|
||||
// File Interface
|
||||
virtual bool ExtraFileHash(const std::string &path, std::string filename) = 0;
|
||||
virtual bool ExtraFileRemove(const RsFileHash &hash) = 0;
|
||||
/**
|
||||
* @brief Share extra file
|
||||
* Can be used to share extra file attached to a channel post
|
||||
* @jsonapi{development}
|
||||
* @param[in] path file path
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool ExtraFileHash(const std::string& path) = 0;
|
||||
|
||||
/**
|
||||
* @brief Remove extra file from shared files
|
||||
* @jsonapi{development}
|
||||
* @param[in] hash hash of the file to remove
|
||||
* @return false on error, true otherwise
|
||||
*/
|
||||
virtual bool ExtraFileRemove(const RsFileHash& hash) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue