|
| 1 | +/** |
| 2 | + * DeepDetect |
| 3 | + * Copyright (c) 2020 Jolibrain SASU |
| 4 | + * Author: Mehdi Abaakouk <mehdi.abaakouk@jolibrain.com> |
| 5 | + * |
| 6 | + * This file is part of deepdetect. |
| 7 | + * |
| 8 | + * deepdetect is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU Lesser General Public License as published by |
| 10 | + * the Free Software Foundation, either version 3 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * deepdetect is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU Lesser General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Lesser General Public License |
| 19 | + * along with deepdetect. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + */ |
| 21 | + |
| 22 | +#ifndef HTTP_DTO_INFO_H |
| 23 | +#define HTTP_DTO_INFO_H |
| 24 | + |
| 25 | +#include "dd_config.h" |
| 26 | +#include "oatpp/core/Types.hpp" |
| 27 | +#include "oatpp/core/macro/codegen.hpp" |
| 28 | + |
| 29 | +#include OATPP_CODEGEN_BEGIN(DTO) ///< Begin DTO codegen section |
| 30 | + |
| 31 | +class Service : public oatpp::DTO |
| 32 | +{ |
| 33 | + DTO_INIT(Service, DTO /* extends */) |
| 34 | + |
| 35 | + DTO_FIELD(String, name); |
| 36 | + DTO_FIELD(String, description); |
| 37 | + DTO_FIELD(String, mllib); |
| 38 | + DTO_FIELD(String, mltype); |
| 39 | + DTO_FIELD(Boolean, predict) = false; |
| 40 | + DTO_FIELD(Boolean, training) = false; |
| 41 | +}; |
| 42 | + |
| 43 | +class InfoHead : public oatpp::DTO |
| 44 | +{ |
| 45 | + DTO_INIT(InfoHead, DTO /* extends */) |
| 46 | + DTO_FIELD(String, method) = "/info"; |
| 47 | + |
| 48 | + // Why this is not in body ? |
| 49 | + DTO_FIELD(String, build_type, "build-type") = BUILD_TYPE; |
| 50 | + DTO_FIELD(String, version) = GIT_VERSION; |
| 51 | + DTO_FIELD(String, branch) = GIT_BRANCH; |
| 52 | + DTO_FIELD(String, commit) = GIT_COMMIT_HASH; |
| 53 | + DTO_FIELD(String, compile_flags) = COMPLIE_FLAGS; |
| 54 | + DTO_FIELD(String, deps_version) = DEPS_VERSION; |
| 55 | + DTO_FIELD(List<Object<Service>>, services); |
| 56 | +}; |
| 57 | + |
| 58 | +class InfoBody : public oatpp::DTO |
| 59 | +{ |
| 60 | + DTO_INIT(InfoBody, DTO /* extends */) |
| 61 | +}; |
| 62 | + |
| 63 | +class Status : public oatpp::DTO |
| 64 | +{ |
| 65 | + DTO_INIT(Status, DTO /* extends */) |
| 66 | + DTO_FIELD(Int32, code); |
| 67 | + DTO_FIELD(String, msg); |
| 68 | + DTO_FIELD(Int32, dd_code); |
| 69 | + DTO_FIELD(String, dd_msg); |
| 70 | +}; |
| 71 | + |
| 72 | +class InfoResponse : public oatpp::DTO |
| 73 | +{ |
| 74 | + DTO_INIT(InfoResponse, DTO /* extends */) |
| 75 | + DTO_FIELD(String, dd_msg); |
| 76 | + DTO_FIELD(Object<Status>, status); |
| 77 | + DTO_FIELD(Object<InfoHead>, head); |
| 78 | + DTO_FIELD(Object<InfoBody>, body); |
| 79 | +}; |
| 80 | + |
| 81 | +#include OATPP_CODEGEN_END(DTO) ///< End DTO codegen section |
| 82 | + |
| 83 | +#endif // HTTP_DTO_INFO_H |
0 commit comments