mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 11:16:34 -04:00
Implement automatic JSON API generation
qmake file add jsonapi-generator target to compile JSON API generator qmake files add rs_jsonapi CONFIG option to enable/disable JSON API at compile time RsTypeSerializer pass down same serialization flags when creating new context for nested objects serial job RsGxsChannels expose a few methods through JSON API as example Derive a few GXS types (RsGxsChannelGroup, RsGxsChannelPost, RsGxsFile, RsMsgMetaData) from RsSerializables so they can be used for the JSON API Create RsGenericSerializer::SERIALIZATION_FLAG_YIELDING so JSON objects that miss some fields can be still deserialized, this improve API usability SerializeContext offer friendly constructor with default paramethers Add restbed 4.6 library as git submodule as most systems doesn't have it yet Add a bit of documentation about JSON API into jsonapi-generator/README.adoc Add JsonApiServer class to expose the JSON API via HTTP protocol
This commit is contained in:
parent
2f159efb10
commit
7ad337c8d2
22 changed files with 1205 additions and 83 deletions
|
@ -22,6 +22,9 @@ resource_api::ApiServerMHD* WebuiPage::apiServerMHD = 0;
|
|||
resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0;
|
||||
#endif
|
||||
resource_api::RsControlModule* WebuiPage::controlModule = 0;
|
||||
#ifdef RS_JSONAPI
|
||||
JsonApiServer* WebuiPage::jsonApiServer = nullptr;
|
||||
#endif
|
||||
|
||||
WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||
{
|
||||
|
@ -105,6 +108,10 @@ QString WebuiPage::helpText() const
|
|||
// TODO: LIBRESAPI_LOCAL_SERVER Move in appropriate place
|
||||
#ifdef LIBRESAPI_LOCAL_SERVER
|
||||
apiServerLocal = new resource_api::ApiServerLocal(apiServer, resource_api::ApiServerLocal::serverPath());
|
||||
#endif
|
||||
#ifdef RS_JSONAPI
|
||||
jsonApiServer = new JsonApiServer(9092);
|
||||
jsonApiServer->start("WebuiPage::jsonApiServer");
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
@ -126,6 +133,10 @@ QString WebuiPage::helpText() const
|
|||
delete controlModule;
|
||||
controlModule = 0;
|
||||
}
|
||||
#ifdef RS_JSONAPI
|
||||
delete jsonApiServer;
|
||||
jsonApiServer = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*static*/ void WebuiPage::showWebui()
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
#include <retroshare-gui/configpage.h>
|
||||
#include "ui_WebuiPage.h"
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
# include "jsonapi/jsonapi.h"
|
||||
#endif
|
||||
|
||||
namespace resource_api{
|
||||
class ApiServer;
|
||||
class ApiServerMHD;
|
||||
|
@ -55,4 +59,7 @@ private:
|
|||
static resource_api::ApiServerLocal* apiServerLocal;
|
||||
#endif
|
||||
static resource_api::RsControlModule* controlModule;
|
||||
#ifdef RS_JSONAPI
|
||||
static JsonApiServer* jsonApiServer;
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue