aboutsummaryrefslogtreecommitdiff
path: root/api/umosapi.h
blob: 20c6d7bf576be8c3b7187e2f8ffea170f8cc61aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef UmosapiService_H_
#define UmosapiService_H_

#include <pistache/http.h>
#include <pistache/description.h>
#include <pistache/endpoint.h>

#include <pistache/serializer/rapidjson.h>

using namespace Pistache;

class UmosapiService {
    public:

        UmosapiService(Address addr);
        virtual ~UmosapiService() {};

        void init(size_t thr);

        void start(std::string swaggerui);

    private:
        void createDescription();

        void retrieveAll(const Rest::Request& request, Http::ResponseWriter response);

        void addUObject(const Rest::Request& request, Http::ResponseWriter response);

        void deleteUObject(const Rest::Request& request, Http::ResponseWriter response);

        void searchUObjectByKeyValue(const Rest::Request& request, Http::ResponseWriter response);

        std::shared_ptr<Http::Endpoint> httpEndpoint;
        Rest::Description desc;
        Rest::Router router;
};
#endif