/*
* Orthanc API
*
* This is the full documentation of the [REST API](https://orthanc.uclouvain.be/book/users/rest.html) of Orthanc.<p>This reference is automatically generated from the source code of Orthanc. A [shorter cheat sheet](https://orthanc.uclouvain.be/book/users/rest-cheatsheet.html) is part of the Orthanc Book.<p>An earlier, manually crafted version from August 2019, is [still available](2019-08-orthanc-openapi.html), but is not up-to-date anymore ([source](https://groups.google.com/g/orthanc-users/c/NUiJTEICSl8/m/xKeqMrbqAAAJ)).
*
* The version of the OpenAPI document: 1.12.8
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`plugins_explorer_js_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PluginsExplorerJsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`plugins_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PluginsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`plugins_id_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PluginsIdGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`statistics_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StatisticsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`system_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SystemGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_accepted_sop_classes_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsAcceptedSopClassesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_accepted_transfer_syntaxes_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsAcceptedTransferSyntaxesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_accepted_transfer_syntaxes_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsAcceptedTransferSyntaxesPutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_bulk_anonymize_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsBulkAnonymizePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_bulk_content_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsBulkContentPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_bulk_delete_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsBulkDeletePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_bulk_modify_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsBulkModifyPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_count_resources_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCountResourcesPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_archive_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateArchiveGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_archive_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateArchivePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_dicom_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateDicomPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_media_extended_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateMediaExtendedGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_media_extended_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateMediaExtendedPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_media_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateMediaGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_create_media_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsCreateMediaPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_default_encoding_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsDefaultEncodingGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_default_encoding_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsDefaultEncodingPutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_dicom_conformance_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsDicomConformanceGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_dicom_echo_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsDicomEchoPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_execute_script_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsExecuteScriptPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_find_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsFindPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_generate_uid_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsGenerateUidGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_invalidate_tags_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsInvalidateTagsPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_labels_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsLabelsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_lookup_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsLookupPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_metrics_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsMetricsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_metrics_prometheus_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsMetricsPrometheusGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_metrics_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsMetricsPutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_now_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsNowGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_now_local_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsNowLocalGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_reconstruct_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsReconstructPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_reset_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsResetPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_shutdown_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsShutdownPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_unknown_sop_class_accepted_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsUnknownSopClassAcceptedGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`tools_unknown_sop_class_accepted_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolsUnknownSopClassAcceptedPutError {
UnknownValue(serde_json::Value),
}
/// Get the JavaScript extensions that are installed by all the plugins using the `OrthancPluginExtendOrthancExplorer()` function of the plugin SDK. This route is for internal use of Orthanc Explorer.
pub async fn plugins_explorer_js_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<PluginsExplorerJsGetError>> {
let uri_str = format!("{}/plugins/explorer.js", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PluginsExplorerJsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// List all the installed plugins
pub async fn plugins_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<PluginsGetError>> {
let uri_str = format!("{}/plugins", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PluginsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get system information about the plugin whose identifier is provided in the URL
pub async fn plugins_id_get(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<PluginsIdGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/plugins/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PluginsIdGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get statistics related to the database of Orthanc
pub async fn statistics_get(configuration: &configuration::Configuration, ) -> Result<models::StatisticsGet200Response, Error<StatisticsGetError>> {
let uri_str = format!("{}/statistics", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::StatisticsGet200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::StatisticsGet200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<StatisticsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get system information about Orthanc
pub async fn system_get(configuration: &configuration::Configuration, ) -> Result<models::SystemGet200Response, Error<SystemGetError>> {
let uri_str = format!("{}/system", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SystemGet200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SystemGet200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SystemGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the list of SOP Class UIDs that are accepted by Orthanc C-STORE SCP. This corresponds to the configuration options `AcceptedSopClasses` and `RejectedSopClasses`.
pub async fn tools_accepted_sop_classes_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsAcceptedSopClassesGetError>> {
let uri_str = format!("{}/tools/accepted-sop-classes", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsAcceptedSopClassesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the list of UIDs of the DICOM transfer syntaxes that are accepted by Orthanc C-STORE SCP. This corresponds to the configuration options `AcceptedTransferSyntaxes` and `XXXTransferSyntaxAccepted`.
pub async fn tools_accepted_transfer_syntaxes_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsAcceptedTransferSyntaxesGetError>> {
let uri_str = format!("{}/tools/accepted-transfer-syntaxes", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsAcceptedTransferSyntaxesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Set the DICOM transfer syntaxes that accepted by Orthanc C-STORE SCP
pub async fn tools_accepted_transfer_syntaxes_put(configuration: &configuration::Configuration, body: Option<serde_json::Value>) -> Result<serde_json::Value, Error<ToolsAcceptedTransferSyntaxesPutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/tools/accepted-transfer-syntaxes", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsAcceptedTransferSyntaxesPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Start a job that will anonymize all the DICOM patients, studies, series or instances whose identifiers are provided in the `Resources` field.
pub async fn tools_bulk_anonymize_post(configuration: &configuration::Configuration, tools_bulk_anonymize_post_request: Option<models::ToolsBulkAnonymizePostRequest>) -> Result<models::ToolsBulkAnonymizePost200Response, Error<ToolsBulkAnonymizePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_bulk_anonymize_post_request = tools_bulk_anonymize_post_request;
let uri_str = format!("{}/tools/bulk-anonymize", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_bulk_anonymize_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ToolsBulkAnonymizePost200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ToolsBulkAnonymizePost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsBulkAnonymizePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the content all the DICOM patients, studies, series or instances whose identifiers are provided in the `Resources` field, in one single call.
pub async fn tools_bulk_content_post(configuration: &configuration::Configuration, tools_bulk_content_post_request: Option<models::ToolsBulkContentPostRequest>) -> Result<(), Error<ToolsBulkContentPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_bulk_content_post_request = tools_bulk_content_post_request;
let uri_str = format!("{}/tools/bulk-content", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_bulk_content_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsBulkContentPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete all the DICOM patients, studies, series or instances whose identifiers are provided in the `Resources` field.
pub async fn tools_bulk_delete_post(configuration: &configuration::Configuration, tools_bulk_delete_post_request: Option<models::ToolsBulkDeletePostRequest>) -> Result<(), Error<ToolsBulkDeletePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_bulk_delete_post_request = tools_bulk_delete_post_request;
let uri_str = format!("{}/tools/bulk-delete", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_bulk_delete_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsBulkDeletePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Start a job that will modify all the DICOM patients, studies, series or instances whose identifiers are provided in the `Resources` field.
pub async fn tools_bulk_modify_post(configuration: &configuration::Configuration, tools_bulk_modify_post_request: Option<models::ToolsBulkModifyPostRequest>) -> Result<models::ToolsBulkModifyPost200Response, Error<ToolsBulkModifyPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_bulk_modify_post_request = tools_bulk_modify_post_request;
let uri_str = format!("{}/tools/bulk-modify", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_bulk_modify_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ToolsBulkModifyPost200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ToolsBulkModifyPost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsBulkModifyPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This URI can be used to count the resources that are matching criteria on the content of the local Orthanc server, in a way that is similar to tools/find
pub async fn tools_count_resources_post(configuration: &configuration::Configuration, tools_count_resources_post_request: Option<models::ToolsCountResourcesPostRequest>) -> Result<serde_json::Value, Error<ToolsCountResourcesPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_count_resources_post_request = tools_count_resources_post_request;
let uri_str = format!("{}/tools/count-resources", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_count_resources_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsCountResourcesPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a ZIP archive containing the DICOM resources (patients, studies, series, or instances) whose Orthanc identifiers are provided in the 'resources' argument
pub async fn tools_create_archive_get(configuration: &configuration::Configuration, resources: &str, filename: Option<&str>, lossy_quality: Option<f64>, transcode: Option<&str>) -> Result<(), Error<ToolsCreateArchiveGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_resources = resources;
let p_filename = filename;
let p_lossy_quality = lossy_quality;
let p_transcode = transcode;
let uri_str = format!("{}/tools/create-archive", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_filename {
req_builder = req_builder.query(&[("filename", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_lossy_quality {
req_builder = req_builder.query(&[("lossy-quality", ¶m_value.to_string())]);
}
req_builder = req_builder.query(&[("resources", &p_resources.to_string())]);
if let Some(ref param_value) = p_transcode {
req_builder = req_builder.query(&[("transcode", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateArchiveGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a ZIP archive containing the DICOM resources (patients, studies, series, or instances) whose Orthanc identifiers are provided in the body
pub async fn tools_create_archive_post(configuration: &configuration::Configuration, tools_create_archive_post_request: Option<models::ToolsCreateArchivePostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<ToolsCreateArchivePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_create_archive_post_request = tools_create_archive_post_request;
let uri_str = format!("{}/tools/create-archive", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_create_archive_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PatientsIdArchivePost200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PatientsIdArchivePost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateArchivePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create one DICOM instance, and store it into Orthanc
pub async fn tools_create_dicom_post(configuration: &configuration::Configuration, tools_create_dicom_post_request: Option<models::ToolsCreateDicomPostRequest>) -> Result<models::ToolsCreateDicomPost200Response, Error<ToolsCreateDicomPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_create_dicom_post_request = tools_create_dicom_post_request;
let uri_str = format!("{}/tools/create-dicom", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_create_dicom_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ToolsCreateDicomPost200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ToolsCreateDicomPost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateDicomPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a DICOMDIR media containing the DICOM resources (patients, studies, series, or instances) whose Orthanc identifiers are provided in the 'resources' argument
pub async fn tools_create_media_extended_get(configuration: &configuration::Configuration, resources: &str, filename: Option<&str>, lossy_quality: Option<f64>, transcode: Option<&str>) -> Result<(), Error<ToolsCreateMediaExtendedGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_resources = resources;
let p_filename = filename;
let p_lossy_quality = lossy_quality;
let p_transcode = transcode;
let uri_str = format!("{}/tools/create-media-extended", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_filename {
req_builder = req_builder.query(&[("filename", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_lossy_quality {
req_builder = req_builder.query(&[("lossy-quality", ¶m_value.to_string())]);
}
req_builder = req_builder.query(&[("resources", &p_resources.to_string())]);
if let Some(ref param_value) = p_transcode {
req_builder = req_builder.query(&[("transcode", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateMediaExtendedGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a DICOMDIR media containing the DICOM resources (patients, studies, series, or instances) whose Orthanc identifiers are provided in the body
pub async fn tools_create_media_extended_post(configuration: &configuration::Configuration, tools_create_media_extended_post_request: Option<models::ToolsCreateMediaExtendedPostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<ToolsCreateMediaExtendedPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_create_media_extended_post_request = tools_create_media_extended_post_request;
let uri_str = format!("{}/tools/create-media-extended", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_create_media_extended_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PatientsIdArchivePost200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PatientsIdArchivePost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateMediaExtendedPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a DICOMDIR media containing the DICOM resources (patients, studies, series, or instances) whose Orthanc identifiers are provided in the 'resources' argument
pub async fn tools_create_media_get(configuration: &configuration::Configuration, resources: &str, filename: Option<&str>, lossy_quality: Option<f64>, transcode: Option<&str>) -> Result<(), Error<ToolsCreateMediaGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_resources = resources;
let p_filename = filename;
let p_lossy_quality = lossy_quality;
let p_transcode = transcode;
let uri_str = format!("{}/tools/create-media", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_filename {
req_builder = req_builder.query(&[("filename", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_lossy_quality {
req_builder = req_builder.query(&[("lossy-quality", ¶m_value.to_string())]);
}
req_builder = req_builder.query(&[("resources", &p_resources.to_string())]);
if let Some(ref param_value) = p_transcode {
req_builder = req_builder.query(&[("transcode", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateMediaGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a DICOMDIR media containing the DICOM resources (patients, studies, series, or instances) whose Orthanc identifiers are provided in the body
pub async fn tools_create_media_post(configuration: &configuration::Configuration, tools_create_media_post_request: Option<models::ToolsCreateMediaPostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<ToolsCreateMediaPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_create_media_post_request = tools_create_media_post_request;
let uri_str = format!("{}/tools/create-media", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_create_media_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PatientsIdArchivePost200Response`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PatientsIdArchivePost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsCreateMediaPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the default encoding that is used by Orthanc if parsing a DICOM instance without the `SpecificCharacterEncoding` tag, or during C-FIND. This corresponds to the configuration option `DefaultEncoding`.
pub async fn tools_default_encoding_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsDefaultEncodingGetError>> {
let uri_str = format!("{}/tools/default-encoding", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsDefaultEncodingGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Change the default encoding that is used by Orthanc if parsing a DICOM instance without the `SpecificCharacterEncoding` tag, or during C-FIND. This corresponds to the configuration option `DefaultEncoding`.
pub async fn tools_default_encoding_put(configuration: &configuration::Configuration, body: Option<serde_json::Value>) -> Result<(), Error<ToolsDefaultEncodingPutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/tools/default-encoding", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsDefaultEncodingPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the DICOM conformance statement of Orthanc
pub async fn tools_dicom_conformance_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsDicomConformanceGetError>> {
let uri_str = format!("{}/tools/dicom-conformance", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsDicomConformanceGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Trigger C-ECHO SCU command against a DICOM modality described in the POST body, without having to register the modality in some `/modalities/{id}` (new in Orthanc 1.8.1)
pub async fn tools_dicom_echo_post(configuration: &configuration::Configuration, tools_dicom_echo_post_request: Option<models::ToolsDicomEchoPostRequest>) -> Result<(), Error<ToolsDicomEchoPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_dicom_echo_post_request = tools_dicom_echo_post_request;
let uri_str = format!("{}/tools/dicom-echo", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_dicom_echo_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsDicomEchoPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Execute the provided Lua script by the Orthanc server. This is very insecure for Orthanc servers that are remotely accessible. Since Orthanc 1.5.8, this route is disabled by default and can be enabled thanks to the `ExecuteLuaEnabled` configuration.
pub async fn tools_execute_script_post(configuration: &configuration::Configuration, body: Option<serde_json::Value>) -> Result<serde_json::Value, Error<ToolsExecuteScriptPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/tools/execute-script", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsExecuteScriptPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This URI can be used to perform a search on the content of the local Orthanc server, in a way that is similar to querying remote DICOM modalities using C-FIND SCU: https://orthanc.uclouvain.be/book/users/rest.html#performing-finds-within-orthanc
pub async fn tools_find_post(configuration: &configuration::Configuration, tools_find_post_request: Option<models::ToolsFindPostRequest>) -> Result<serde_json::Value, Error<ToolsFindPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_find_post_request = tools_find_post_request;
let uri_str = format!("{}/tools/find", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_find_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsFindPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Generate a random DICOM identifier
pub async fn tools_generate_uid_get(configuration: &configuration::Configuration, level: &str) -> Result<serde_json::Value, Error<ToolsGenerateUidGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_level = level;
let uri_str = format!("{}/tools/generate-uid", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("level", &p_level.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsGenerateUidGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Remove all the attachments of the type \"DICOM-as-JSON\" that are associated will all the DICOM instances stored in Orthanc. These summaries will be automatically re-created on the next access. This is notably useful after changes to the `Dictionary` configuration option. https://orthanc.uclouvain.be/book/faq/orthanc-storage.html#storage-area
pub async fn tools_invalidate_tags_post(configuration: &configuration::Configuration, ) -> Result<(), Error<ToolsInvalidateTagsPostError>> {
let uri_str = format!("{}/tools/invalidate-tags", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsInvalidateTagsPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// List all the labels that are associated with any resource of the Orthanc database
pub async fn tools_labels_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsLabelsGetError>> {
let uri_str = format!("{}/tools/labels", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsLabelsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This URI can be used to convert one DICOM identifier to a list of matching Orthanc resources
pub async fn tools_lookup_post(configuration: &configuration::Configuration, body: Option<serde_json::Value>) -> Result<serde_json::Value, Error<ToolsLookupPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/tools/lookup", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsLookupPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a Boolean specifying whether Prometheus metrics are collected and exposed at `/tools/metrics-prometheus`
pub async fn tools_metrics_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsMetricsGetError>> {
let uri_str = format!("{}/tools/metrics", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsMetricsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get usage metrics of Orthanc in the Prometheus file format (OpenMetrics): https://orthanc.uclouvain.be/book/users/advanced-rest.html#instrumentation-with-prometheus
pub async fn tools_metrics_prometheus_get(configuration: &configuration::Configuration, ) -> Result<(), Error<ToolsMetricsPrometheusGetError>> {
let uri_str = format!("{}/tools/metrics-prometheus", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsMetricsPrometheusGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Enable or disable the collection and publication of metrics at `/tools/metrics-prometheus`
pub async fn tools_metrics_put(configuration: &configuration::Configuration, body: Option<serde_json::Value>) -> Result<(), Error<ToolsMetricsPutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/tools/metrics", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsMetricsPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get UTC time
pub async fn tools_now_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsNowGetError>> {
let uri_str = format!("{}/tools/now", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsNowGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get local time
pub async fn tools_now_local_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsNowLocalGetError>> {
let uri_str = format!("{}/tools/now-local", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsNowLocalGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Reconstruct the index of all the tags of all the DICOM instances that are stored in Orthanc. This is notably useful after the deletion of resources whose children resources have inconsistent values with their sibling resources. Beware that this is a highly time-consuming operation, as all the DICOM instances will be parsed again, and as all the Orthanc index will be regenerated. If you have a large database to process, it is advised to use the Housekeeper plugin to perform this action resource by resource
pub async fn tools_reconstruct_post(configuration: &configuration::Configuration, tools_reconstruct_post_request: Option<models::ToolsReconstructPostRequest>) -> Result<(), Error<ToolsReconstructPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tools_reconstruct_post_request = tools_reconstruct_post_request;
let uri_str = format!("{}/tools/reconstruct", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_tools_reconstruct_post_request);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsReconstructPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Restart Orthanc
pub async fn tools_reset_post(configuration: &configuration::Configuration, ) -> Result<(), Error<ToolsResetPostError>> {
let uri_str = format!("{}/tools/reset", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsResetPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Shutdown Orthanc
pub async fn tools_shutdown_post(configuration: &configuration::Configuration, ) -> Result<(), Error<ToolsShutdownPostError>> {
let uri_str = format!("{}/tools/shutdown", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsShutdownPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Shall Orthanc C-STORE SCP accept DICOM instances with an unknown SOP class UID?
pub async fn tools_unknown_sop_class_accepted_get(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ToolsUnknownSopClassAcceptedGetError>> {
let uri_str = format!("{}/tools/unknown-sop-class-accepted", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ToolsUnknownSopClassAcceptedGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Set whether Orthanc C-STORE SCP should accept DICOM instances with an unknown SOP class UID
pub async fn tools_unknown_sop_class_accepted_put(configuration: &configuration::Configuration, body: Option<serde_json::Value>) -> Result<(), Error<ToolsUnknownSopClassAcceptedPutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/tools/unknown-sop-class-accepted", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ToolsUnknownSopClassAcceptedPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}