comparison OrthancFramework/Sources/RestApi/RestApiHierarchy.h @ 4399:80fd140b12ba

New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Dec 2020 12:21:03 +0100
parents a01b1c9cbef4
children 029366f95217
comparison
equal deleted inserted replaced
4398:38c22715bb56 4399:80fd140b12ba
43 RestApiDeleteCall::Handler deleteHandler_; 43 RestApiDeleteCall::Handler deleteHandler_;
44 44
45 public: 45 public:
46 Resource(); 46 Resource();
47 47
48 bool HasHandler(HttpMethod method) const; 48 bool HasMethod(HttpMethod method) const;
49 49
50 void Register(RestApiGetCall::Handler handler); 50 void Register(RestApiGetCall::Handler handler);
51 51
52 void Register(RestApiPutCall::Handler handler); 52 void Register(RestApiPutCall::Handler handler);
53 53
74 { 74 {
75 } 75 }
76 76
77 virtual bool Visit(const Resource& resource, 77 virtual bool Visit(const Resource& resource,
78 const UriComponents& uri, 78 const UriComponents& uri,
79 const HttpToolbox::Arguments& components, 79 bool hasTrailing,
80 // The two arguments below are empty if using "ExploreAllResources()"
81 const HttpToolbox::Arguments& uriComponents,
80 const UriComponents& trailing) = 0; 82 const UriComponents& trailing) = 0;
81 }; 83 };
82 84
83 85
84 private: 86 private:
85 typedef std::map<std::string, RestApiHierarchy*> Children; 87 typedef std::map<std::string, RestApiHierarchy*> Children;
86 88
87 Resource handlers_; 89 Resource handlers_;
88 Children children_; 90 Children children_;
89 Children wildcardChildren_; 91 Children wildcardChildren_;
90 Resource universalHandlers_; 92 Resource handlersWithTrailing_;
91 93
92 static RestApiHierarchy& AddChild(Children& children, 94 static RestApiHierarchy& AddChild(Children& children,
93 const std::string& name); 95 const std::string& name);
94 96
95 static void DeleteChildren(Children& children); 97 static void DeleteChildren(Children& children);
133 bool LookupResource(const UriComponents& uri, 135 bool LookupResource(const UriComponents& uri,
134 IVisitor& visitor); 136 IVisitor& visitor);
135 137
136 void GetAcceptedMethods(std::set<HttpMethod>& methods, 138 void GetAcceptedMethods(std::set<HttpMethod>& methods,
137 const UriComponents& uri); 139 const UriComponents& uri);
140
141 void ExploreAllResources(IVisitor& visitor,
142 const UriComponents& path) const;
138 }; 143 };
139 } 144 }