Mercurial > hg > orthanc
diff OrthancFramework/Sources/RestApi/RestApiCall.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 | 3af1d763763a |
children | 4cb9f66a1c7c |
line wrap: on
line diff
--- a/OrthancFramework/Sources/RestApi/RestApiCall.h Tue Dec 22 09:39:06 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiCall.h Wed Dec 23 12:21:03 2020 +0100 @@ -23,6 +23,7 @@ #pragma once #include "../HttpServer/HttpToolbox.h" +#include "RestApiCallDocumentation.h" #include "RestApiPath.h" #include "RestApiOutput.h" @@ -44,6 +45,8 @@ const HttpToolbox::Arguments& uriComponents_; const UriComponents& trailing_; const UriComponents& fullUri_; + HttpMethod method_; // To create RestApiCallDocumentation on demand + std::unique_ptr<RestApiCallDocumentation> documentation_; // Lazy creation public: RestApiCall(RestApiOutput& output, @@ -51,6 +54,7 @@ RequestOrigin origin, const char* remoteIp, const char* username, + HttpMethod method, const HttpToolbox::Arguments& httpHeaders, const HttpToolbox::Arguments& uriComponents, const UriComponents& trailing, @@ -63,7 +67,8 @@ httpHeaders_(httpHeaders), uriComponents_(uriComponents), trailing_(trailing), - fullUri_(fullUri) + fullUri_(fullUri), + method_(method) { } @@ -127,5 +132,12 @@ } virtual bool ParseJsonRequest(Json::Value& result) const = 0; + + RestApiCallDocumentation& GetDocumentation(); + + bool IsDocumentation() const + { + return (origin_ == RequestOrigin_Documentation); + } }; }