comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4401:354ea95b294a

documenting system calls
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Dec 2020 15:13:45 +0100
parents 80fd140b12ba
children ad646ff506d0
comparison
equal deleted inserted replaced
4400:029366f95217 4401:354ea95b294a
170 .SetDescription("List the Orthanc identifiers of all the available DICOM " + resources) 170 .SetDescription("List the Orthanc identifiers of all the available DICOM " + resources)
171 .SetHttpGetArgument("limit", RestApiCallDocumentation::Type_Number, "Limit the number of results") 171 .SetHttpGetArgument("limit", RestApiCallDocumentation::Type_Number, "Limit the number of results")
172 .SetHttpGetArgument("since", RestApiCallDocumentation::Type_Number, "Show only the resources since the provided index") 172 .SetHttpGetArgument("since", RestApiCallDocumentation::Type_Number, "Show only the resources since the provided index")
173 .SetHttpGetArgument("expand", RestApiCallDocumentation::Type_String, 173 .SetHttpGetArgument("expand", RestApiCallDocumentation::Type_String,
174 "If present, retrieve detailed information about the individual " + resources) 174 "If present, retrieve detailed information about the individual " + resources)
175 .SetHttpGetSample("https://demo.orthanc-server.com/" + resources + "?since=0&limit=2"); 175 .SetHttpGetSample("https://demo.orthanc-server.com/" + resources + "?since=0&limit=2", true);
176 return; 176 return;
177 } 177 }
178 178
179 ServerIndex& index = OrthancRestApi::GetIndex(call); 179 ServerIndex& index = OrthancRestApi::GetIndex(call);
180 180
237 const std::string resource = GetResourceTypeText(resourceType, false /* plural */, false /* lower case */); 237 const std::string resource = GetResourceTypeText(resourceType, false /* plural */, false /* lower case */);
238 call.GetDocumentation() 238 call.GetDocumentation()
239 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */)) 239 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */))
240 .SetSummary("Get information about some " + resource) 240 .SetSummary("Get information about some " + resource)
241 .SetDescription("Get information about the DICOM " + resource + " of interest whose Orthanc identifier is provided in the URL") 241 .SetDescription("Get information about the DICOM " + resource + " of interest whose Orthanc identifier is provided in the URL")
242 .SetUriComponent("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the " + resource + " of interest") 242 .SetUriArgument("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the " + resource + " of interest")
243 .SetHttpGetSample(sampleUrl); 243 .SetHttpGetSample(sampleUrl, true);
244 return; 244 return;
245 } 245 }
246 246
247 Json::Value result; 247 Json::Value result;
248 if (OrthancRestApi::GetIndex(call).LookupResource(result, call.GetUriComponent("id", ""), resourceType)) 248 if (OrthancRestApi::GetIndex(call).LookupResource(result, call.GetUriComponent("id", ""), resourceType))
259 const std::string resource = GetResourceTypeText(resourceType, false /* plural */, false /* lower case */); 259 const std::string resource = GetResourceTypeText(resourceType, false /* plural */, false /* lower case */);
260 call.GetDocumentation() 260 call.GetDocumentation()
261 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */)) 261 .SetTag(GetResourceTypeText(resourceType, true /* plural */, true /* upper case */))
262 .SetSummary("Delete some " + resource) 262 .SetSummary("Delete some " + resource)
263 .SetDescription("Delete the DICOM " + resource + " of interest whose Orthanc identifier is provided in the URL") 263 .SetDescription("Delete the DICOM " + resource + " of interest whose Orthanc identifier is provided in the URL")
264 .SetUriComponent("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the " + resource + " of interest"); 264 .SetUriArgument("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the " + resource + " of interest");
265 return; 265 return;
266 } 266 }
267 267
268 Json::Value result; 268 Json::Value result;
269 if (OrthancRestApi::GetContext(call).DeleteResource(result, call.GetUriComponent("id", ""), resourceType)) 269 if (OrthancRestApi::GetContext(call).DeleteResource(result, call.GetUriComponent("id", ""), resourceType))
280 if (call.IsDocumentation()) 280 if (call.IsDocumentation())
281 { 281 {
282 call.GetDocumentation() 282 call.GetDocumentation()
283 .SetTag("Patients") 283 .SetTag("Patients")
284 .SetSummary("Is the patient protected against recycling?") 284 .SetSummary("Is the patient protected against recycling?")
285 .SetUriComponent("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the patient of interest") 285 .SetUriArgument("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the patient of interest")
286 .AddAnswerType(MimeType_PlainText, "\"1\" if protected, \"0\" if not protected"); 286 .AddAnswerType(MimeType_PlainText, "\"1\" if protected, \"0\" if not protected");
287 return; 287 return;
288 } 288 }
289 289
290 std::string publicId = call.GetUriComponent("id", ""); 290 std::string publicId = call.GetUriComponent("id", "");
299 { 299 {
300 call.GetDocumentation() 300 call.GetDocumentation()
301 .SetTag("Patients") 301 .SetTag("Patients")
302 .SetSummary("Protect one patient against recycling") 302 .SetSummary("Protect one patient against recycling")
303 .SetDescription("Check out configuration options \"MaximumStorageSize\" and \"MaximumPatientCount\"") 303 .SetDescription("Check out configuration options \"MaximumStorageSize\" and \"MaximumPatientCount\"")
304 .SetUriComponent("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the patient of interest"); 304 .SetUriArgument("id", RestApiCallDocumentation::Type_String, "Orthanc identifier of the patient of interest");
305 return; 305 return;
306 } 306 }
307 307
308 ServerContext& context = OrthancRestApi::GetContext(call); 308 ServerContext& context = OrthancRestApi::GetContext(call);
309 309