Mercurial > hg > orthanc
comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4418:9d6fa3da8f00
cont openapi
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Dec 2020 10:24:17 +0100 |
parents | 0b27841950d5 |
children | cd96c807ca3d |
comparison
equal
deleted
inserted
replaced
4417:a4518adede59 | 4418:9d6fa3da8f00 |
---|---|
1307 } | 1307 } |
1308 | 1308 |
1309 | 1309 |
1310 static void GetResourceStatistics(RestApiGetCall& call) | 1310 static void GetResourceStatistics(RestApiGetCall& call) |
1311 { | 1311 { |
1312 if (call.IsDocumentation()) | |
1313 { | |
1314 ResourceType t = StringToResourceType(call.GetFullUri()[0].c_str()); | |
1315 std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); | |
1316 call.GetDocumentation() | |
1317 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) | |
1318 .SetSummary("Get " + r + " statistics") | |
1319 .SetDescription("Get statistics about the given " + r) | |
1320 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") | |
1321 .SetAnswerField("DiskSize", RestApiCallDocumentation::Type_String, | |
1322 "Size of the " + r + " on the disk in bytes, expressed as a string for 64bit compatibility with JSON") | |
1323 .SetAnswerField("DiskSizeMB", RestApiCallDocumentation::Type_Number, | |
1324 "Size of the " + r + " on the disk, expressed in megabytes (MB)") | |
1325 .SetAnswerField("UncompressedSize", RestApiCallDocumentation::Type_String, | |
1326 "Size of the " + r + " after decompression in bytes, expressed as a string for 64bit compatibility with JSON") | |
1327 .SetAnswerField("UncompressedSizeMB", RestApiCallDocumentation::Type_Number, | |
1328 "Size of the " + r + " after decompression, expressed in megabytes (MB). " | |
1329 "This is different from `DiskSizeMB` iff `StorageCompression` is `true`.") | |
1330 .SetAnswerField("DicomDiskSize", RestApiCallDocumentation::Type_String, | |
1331 "Size on the disk of the DICOM instances associated with the " + r + ", expressed in bytes") | |
1332 .SetAnswerField("DicomDiskSizeMB", RestApiCallDocumentation::Type_Number, | |
1333 "Size on the disk of the DICOM instances associated with the " + r + ", expressed in megabytes (MB)") | |
1334 .SetAnswerField("DicomUncompressedSize", RestApiCallDocumentation::Type_String, | |
1335 "Size on the disk of the uncompressed DICOM instances associated with the " + r + ", expressed in bytes") | |
1336 .SetAnswerField("DicomUncompressedSizeMB", RestApiCallDocumentation::Type_Number, | |
1337 "Size on the disk of the uncompressed DICOM instances associated with the " + r + ", expressed in megabytes (MB)") | |
1338 .SetHttpGetSample(GetDocumentationSampleResource(t) + "/statistics", true); | |
1339 | |
1340 switch (t) | |
1341 { | |
1342 // Do NOT add "break" below this point! | |
1343 case ResourceType_Patient: | |
1344 call.GetDocumentation().SetAnswerField("CountStudies", RestApiCallDocumentation::Type_Number, | |
1345 "Number of child studies within this " + r); | |
1346 | |
1347 case ResourceType_Study: | |
1348 call.GetDocumentation().SetAnswerField("CountSeries", RestApiCallDocumentation::Type_Number, | |
1349 "Number of child series within this " + r); | |
1350 | |
1351 case ResourceType_Series: | |
1352 call.GetDocumentation().SetAnswerField("CountInstances", RestApiCallDocumentation::Type_Number, | |
1353 "Number of child instances within this " + r); | |
1354 | |
1355 case ResourceType_Instance: | |
1356 default: | |
1357 break; | |
1358 } | |
1359 | |
1360 return; | |
1361 } | |
1362 | |
1312 static const uint64_t MEGA_BYTES = 1024 * 1024; | 1363 static const uint64_t MEGA_BYTES = 1024 * 1024; |
1313 | 1364 |
1314 std::string publicId = call.GetUriComponent("id", ""); | 1365 std::string publicId = call.GetUriComponent("id", ""); |
1315 | 1366 |
1316 ResourceType type; | 1367 ResourceType type; |
1630 std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); | 1681 std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); |
1631 call.GetDocumentation() | 1682 call.GetDocumentation() |
1632 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) | 1683 .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) |
1633 .SetSummary("Get attachment" + std::string(uncompress ? "" : " (no decompression)")) | 1684 .SetSummary("Get attachment" + std::string(uncompress ? "" : " (no decompression)")) |
1634 .SetDescription("Get the (binary) content of one attachment associated with the given " + r + | 1685 .SetDescription("Get the (binary) content of one attachment associated with the given " + r + |
1635 std::string(uncompress ? "" : ". The attachment will not be decompressed if `StorageCompression` if `true`.")) | 1686 std::string(uncompress ? "" : ". The attachment will not be decompressed if `StorageCompression` is `true`.")) |
1636 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") | 1687 .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") |
1637 .SetUriArgument("name", "The name of the attachment, or its index (cf. `UserContentType` configuration option)") | 1688 .SetUriArgument("name", "The name of the attachment, or its index (cf. `UserContentType` configuration option)") |
1638 .AddAnswerType(MimeType_Binary, "The attachment"); | 1689 .AddAnswerType(MimeType_Binary, "The attachment"); |
1639 return; | 1690 return; |
1640 } | 1691 } |