Mercurial > hg > orthanc
comparison OrthancFramework/Sources/RestApi/RestApiCallDocumentation.h @ 4403:ad646ff506d0
cont openapi
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Dec 2020 18:32:13 +0100 |
parents | 354ea95b294a |
children | f34634916d8c |
comparison
equal
deleted
inserted
replaced
4402:b651989194d3 | 4403:ad646ff506d0 |
---|---|
41 Type_Text, | 41 Type_Text, |
42 Type_String, | 42 Type_String, |
43 Type_Number, | 43 Type_Number, |
44 Type_Boolean, | 44 Type_Boolean, |
45 Type_JsonListOfStrings, | 45 Type_JsonListOfStrings, |
46 Type_JsonListOfObjects, | |
46 Type_JsonObject | 47 Type_JsonObject |
47 }; | 48 }; |
48 | 49 |
49 private: | 50 private: |
50 struct Parameter | 51 class Parameter |
51 { | 52 { |
53 private: | |
52 Type type_; | 54 Type type_; |
53 std::string description_; | 55 std::string description_; |
56 bool required_; | |
57 | |
58 public: | |
59 Parameter() : | |
60 type_(Type_Unknown), | |
61 required_(false) | |
62 { | |
63 } | |
64 | |
65 Parameter(Type type, | |
66 const std::string& description, | |
67 bool required) : | |
68 type_(type), | |
69 description_(description), | |
70 required_(required) | |
71 { | |
72 } | |
73 | |
74 Type GetType() const | |
75 { | |
76 return type_; | |
77 } | |
78 | |
79 const std::string& GetDescription() const | |
80 { | |
81 return description_; | |
82 } | |
83 | |
84 bool IsRequired() const | |
85 { | |
86 return required_; | |
87 } | |
54 }; | 88 }; |
55 | 89 |
56 typedef std::map<std::string, Parameter> Parameters; | 90 typedef std::map<std::string, Parameter> Parameters; |
57 typedef std::map<MimeType, std::string> AllowedTypes; | 91 typedef std::map<MimeType, std::string> AllowedTypes; |
58 | 92 |
101 RestApiCallDocumentation& AddRequestType(MimeType mime, | 135 RestApiCallDocumentation& AddRequestType(MimeType mime, |
102 const std::string& description); | 136 const std::string& description); |
103 | 137 |
104 RestApiCallDocumentation& SetRequestField(const std::string& name, | 138 RestApiCallDocumentation& SetRequestField(const std::string& name, |
105 Type type, | 139 Type type, |
106 const std::string& description); | 140 const std::string& description, |
141 bool required); | |
107 | 142 |
108 RestApiCallDocumentation& AddAnswerType(MimeType type, | 143 RestApiCallDocumentation& AddAnswerType(MimeType type, |
109 const std::string& description); | 144 const std::string& description); |
110 | 145 |
111 RestApiCallDocumentation& SetUriArgument(const std::string& name, | 146 RestApiCallDocumentation& SetUriArgument(const std::string& name, |
120 RestApiCallDocumentation& SetHttpHeader(const std::string& name, | 155 RestApiCallDocumentation& SetHttpHeader(const std::string& name, |
121 const std::string& description); | 156 const std::string& description); |
122 | 157 |
123 RestApiCallDocumentation& SetHttpGetArgument(const std::string& name, | 158 RestApiCallDocumentation& SetHttpGetArgument(const std::string& name, |
124 Type type, | 159 Type type, |
125 const std::string& description); | 160 const std::string& description, |
161 bool required); | |
126 | 162 |
127 RestApiCallDocumentation& SetAnswerField(const std::string& name, | 163 RestApiCallDocumentation& SetAnswerField(const std::string& name, |
128 Type type, | 164 Type type, |
129 const std::string& description); | 165 const std::string& description); |
130 | 166 |