~aleteoryx/muditaos

ref: 9eeeb6ae929009c475b2748dc79e3407002876d6 muditaos/module-services/service-desktop/parser/EndpointHandler.hpp -rw-r--r-- 1.9 KiB
9eeeb6ae — Bartek Cichocki [EGD-3502] reworked endpoints and handlers 5 years ago
                                                                                
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
38
39
40
41
42
#pragma once

#include <json/json11.hpp>
#include "Service/Service.hpp"
#include "ParserUtils.hpp"
#include "Service/Common.hpp"
#include <service-desktop/ServiceDesktop.hpp>
#include <string>
#include "DBHelper.hpp"
#include "queries/phonebook/QueryContactGet.hpp"

using namespace ParserStateMachine;

class EndpointHandler
{
  public:
    static void initHelpers(sys::Service *ownerService);

    static sys::ReturnCodes handleQueryMessage(sys::DataMessage *msg, sys::ResponseMessage *resp);
    static sys::ReturnCodes handleContactsMessage(sys::DataMessage *msg, sys::ResponseMessage *resp);
    static sys::ReturnCodes handleMessagesMessage(sys::DataMessage *msg, sys::ResponseMessage *resp);
    static sys::ReturnCodes handleMessageTemplatesMessage(sys::DataMessage *msg, sys::ResponseMessage *resp);

    static sys::ReturnCodes decodeMessage(db::query::ContactGetResult *message);

    static sys::ReturnCodes update(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);
    static sys::ReturnCodes deviceInfo(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);
    static sys::ReturnCodes backup(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);
    static sys::ReturnCodes restore(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);
    static sys::ReturnCodes factory(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);
    static sys::ReturnCodes contacts(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);
    static sys::ReturnCodes messages(
        uint8_t httpMethod, uint32_t uuid, json11::Json &body, std::string &responseStr, sys::Service *ownerService);

  private:
};