~aleteoryx/muditaos

ref: b1f6d67fce033cc451f15721b3d9a51374409ef6 muditaos/module-services/service-desktop/endpoints/developerMode/fs/FS_Helper.hpp -rw-r--r-- 1.2 KiB
b1f6d67f — Jakub Pyszczak [EGD-7505] Developer mode endpoint extended 4 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <endpoints/Context.hpp>
#include <Service/Common.hpp>
#include <endpoints/BaseHelper.hpp>

namespace parserFSM
{

    class FS_Helper : public BaseHelper
    {
      public:
        explicit FS_Helper(sys::Service *p) : BaseHelper(p)
        {}

      private:
        auto processGet(Context &context) -> ProcessResult final;
        auto processPut(Context &context) -> ProcessResult final;
        void preProcess(http::Method method, Context &context) final;

        bool requestFileRemoval(const std::string &fileName);
        bool requestFileRename(const std::string &fileName, const std::string &destFileName) noexcept;
        endpoint::ResponseContext requestListDir(const std::string &directory);
    };

    namespace json::fs
    {
        inline constexpr auto removeFile   = "removeFile";
        inline constexpr auto renameFile   = "renameFile";
        inline constexpr auto destFileName = "destfilename";
        inline constexpr auto listDir      = "listDir";
        inline constexpr auto path         = "path";
    } // namespace json::fs
} // namespace parserFSM