Node.h
1 /*
2  * Copyright 2016 Gigatribe
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GIGA_DATA_NODE_MODEL_H_
18 #define GIGA_DATA_NODE_MODEL_H_
19 
20 #include <boost/optional.hpp>
21 #include <cpprest/details/basic_types.h>
22 #include <vector>
23 #include <memory>
24 #include "../../rest/prepoc_manage.h"
25 
26 namespace giga {
27 namespace data {
28 
32 struct Node {
33  std::string id = {};
34  utility::string_t name = {};
35  boost::optional<std::string> parentId = boost::none;
36  std::vector<std::string> ancestors = {};
37  std::vector<std::string> servers = {};
38  uint64_t ownerId = 0;
39  uint64_t size = 0;
40  uint64_t creationDate = 0;
41  uint64_t lastUpdateDate = 0;
42  uint64_t nbChildren = 0;
43  uint64_t nbFiles = 0;
44  std::vector<std::shared_ptr<Node>> nodes = {};
45  utility::string_t type = {};
46  boost::optional<utility::string_t> mimeType = boost::none;
47  boost::optional<std::string> fid = boost::none;
48  boost::optional<std::string> fkey = boost::none;
49  boost::optional<int64_t> previewState = boost::none;
51  boost::optional<utility::string_t> url = boost::none;
53  boost::optional<utility::string_t> icon = boost::none;
55  boost::optional<utility::string_t> square = boost::none;
57  boost::optional<utility::string_t> original = boost::none;
59  boost::optional<utility::string_t> poster = boost::none;
60 
61  template <class Manager>
62  void visit(const Manager& m) {
63  GIGA_MANAGE(m, id);
64  GIGA_MANAGE(m, name);
65  GIGA_MANAGE(m, parentId);
66  GIGA_MANAGE(m, ancestors);
67  GIGA_MANAGE(m, servers);
68  GIGA_MANAGE(m, ownerId);
69  GIGA_MANAGE(m, size);
70  GIGA_MANAGE(m, creationDate);
71  GIGA_MANAGE(m, lastUpdateDate);
72  GIGA_MANAGE(m, nbChildren);
73  GIGA_MANAGE(m, nbFiles);
74  GIGA_MANAGE(m, nodes);
75  GIGA_MANAGE(m, type);
76  GIGA_MANAGE(m, mimeType);
77  GIGA_MANAGE(m, fid);
78  GIGA_MANAGE(m, fkey);
79  GIGA_MANAGE(m, previewState);
80  GIGA_MANAGE(m, url);
81  GIGA_MANAGE(m, icon);
82  GIGA_MANAGE(m, square);
83  GIGA_MANAGE(m, original);
84  GIGA_MANAGE(m, poster);
85  }
86 };
87 
88 } /* namespace data */
89 } /* namespace giga */
90 #endif /* GIGA_DATA_NODE_MODEL_H_ */
Definition: Node.h:32
boost::optional< utility::string_t > original
Definition: Node.h:57
boost::optional< utility::string_t > icon
Definition: Node.h:53
boost::optional< utility::string_t > url
Definition: Node.h:51
boost::optional< utility::string_t > poster
Definition: Node.h:59
boost::optional< utility::string_t > square
Definition: Node.h:55