libresapi: added channels/create_post

group creation acknowledge not implemented yet

usage:
$ curl --data "{\"group_id\":\"<group_id>\",\"subject\":\"just a test\",\"message\":\"test message\"}" http://<host:port>/api/v2/channels/create_post

parameter object:
{
    group_id: required string,
    subject: required string,
    message: required string,
    thumbnail_base64_png: optional string,
    files: optional array of
        {
            name: required string,
            hash: required string,
            size: required number
        }
}
This commit is contained in:
electron128 2016-02-19 19:22:51 +01:00
parent c5f127f3b1
commit 34957b857a
4 changed files with 143 additions and 3 deletions

View file

@ -14,6 +14,7 @@
#include "StateTokenServer.h" // for the state token serialisers
#include "ApiPluginHandler.h"
#include "ChannelsHandler.h"
/*
data types in json http://json.org/
@ -232,7 +233,8 @@ public:
mFileSearchHandler(sts, ifaces.mNotify, ifaces.mTurtle, ifaces.mFiles),
mTransfersHandler(sts, ifaces.mFiles),
mChatHandler(sts, ifaces.mNotify, ifaces.mMsgs, ifaces.mPeers, ifaces.mIdentity, &mPeersHandler),
mApiPluginHandler(sts, ifaces)
mApiPluginHandler(sts, ifaces),
mChannelsHandler(ifaces.mGxsChannels)
{
// the dynamic cast is to not confuse the addResourceHandler template like this:
// addResourceHandler(derived class, parent class)
@ -254,6 +256,8 @@ public:
&ChatHandler::handleRequest);
router.addResourceHandler("apiplugin", dynamic_cast<ResourceRouter*>(&mApiPluginHandler),
&ChatHandler::handleRequest);
router.addResourceHandler("channels", dynamic_cast<ResourceRouter*>(&mChannelsHandler),
&ChannelsHandler::handleRequest);
}
PeersHandler mPeersHandler;
@ -264,6 +268,7 @@ public:
TransfersHandler mTransfersHandler;
ChatHandler mChatHandler;
ApiPluginHandler mApiPluginHandler;
ChannelsHandler mChannelsHandler;
};
ApiServer::ApiServer():