/*
* 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 [`studies_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_anonymize_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAnonymizePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_archive_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdArchiveGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_archive_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdArchivePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_compress_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameCompressPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_compressed_data_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameCompressedDataGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_compressed_md5_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameCompressedMd5GetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_compressed_size_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameCompressedSizeGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_data_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameDataGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_info_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameInfoGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_is_compressed_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameIsCompressedGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_md5_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameMd5GetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNamePutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_size_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameSizeGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_uncompress_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameUncompressPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_attachments_name_verify_md5_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdAttachmentsNameVerifyMd5PostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_instances_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdInstancesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_instances_tags_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdInstancesTagsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_labels_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdLabelsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_labels_label_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdLabelsLabelDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_labels_label_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdLabelsLabelGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_labels_label_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdLabelsLabelPutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_media_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMediaGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_media_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMediaPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_merge_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMergePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_metadata_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMetadataGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_metadata_name_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMetadataNameDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_metadata_name_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMetadataNameGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_metadata_name_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdMetadataNamePutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_modify_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdModifyPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_module_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdModuleGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_module_patient_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdModulePatientGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_patient_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdPatientGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_reconstruct_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdReconstructPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_series_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdSeriesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_shared_tags_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdSharedTagsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_split_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdSplitPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`studies_id_statistics_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StudiesIdStatisticsGetError {
UnknownValue(serde_json::Value),
}
/// List the Orthanc identifiers of all the available DICOM studies
pub async fn studies_get(configuration: &configuration::Configuration, expand: Option<&str>, full: Option<bool>, limit: Option<f64>, requested_tags: Option<&str>, response_content: Option<&str>, short: Option<bool>, since: Option<f64>) -> Result<serde_json::Value, Error<StudiesGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_expand = expand;
let p_full = full;
let p_limit = limit;
let p_requested_tags = requested_tags;
let p_response_content = response_content;
let p_short = short;
let p_since = since;
let uri_str = format!("{}/studies", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_full {
req_builder = req_builder.query(&[("full", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_requested_tags {
req_builder = req_builder.query(&[("requested-tags", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_response_content {
req_builder = req_builder.query(&[("response-content", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_since {
req_builder = req_builder.query(&[("since", ¶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();
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<StudiesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Start a job that will anonymize all the DICOM instances within the study whose identifier is provided in the URL. The modified DICOM instances will be stored into a brand new study, whose Orthanc identifiers will be returned by the job. https://orthanc.uclouvain.be/book/users/anonymization.html#anonymization-of-patients-studies-or-series
pub async fn studies_id_anonymize_post(configuration: &configuration::Configuration, id: &str, patients_id_anonymize_post_request: Option<models::PatientsIdAnonymizePostRequest>) -> Result<models::ModalitiesIdGetPost200Response, Error<StudiesIdAnonymizePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_patients_id_anonymize_post_request = patients_id_anonymize_post_request;
let uri_str = format!("{}/studies/{id}/anonymize", configuration.base_path, id=crate::apis::urlencode(p_id));
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_patients_id_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::ModalitiesIdGetPost200Response`"))),
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::ModalitiesIdGetPost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<StudiesIdAnonymizePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Synchronously create a ZIP archive containing the DICOM study whose Orthanc identifier is provided in the URL. This flavor is synchronous, which might *not* be desirable to archive large amount of data, as it might lead to network timeouts. Prefer the asynchronous version using `POST` method.
pub async fn studies_id_archive_get(configuration: &configuration::Configuration, id: &str, filename: Option<&str>, lossy_quality: Option<f64>, transcode: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdArchiveGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_filename = filename;
let p_lossy_quality = lossy_quality;
let p_transcode = transcode;
let uri_str = format!("{}/studies/{id}/archive", 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 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())]);
}
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();
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<StudiesIdArchiveGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a ZIP archive containing the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_archive_post(configuration: &configuration::Configuration, id: &str, patients_id_archive_post_request: Option<models::PatientsIdArchivePostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<StudiesIdArchivePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_patients_id_archive_post_request = patients_id_archive_post_request;
let uri_str = format!("{}/studies/{id}/archive", configuration.base_path, id=crate::apis::urlencode(p_id));
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_patients_id_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<StudiesIdArchivePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the list of attachments that are associated with the given study
pub async fn studies_id_attachments_get(configuration: &configuration::Configuration, id: &str, full: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_full = full;
let uri_str = format!("{}/studies/{id}/attachments", 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 param_value) = p_full {
req_builder = req_builder.query(&[("full", ¶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();
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<StudiesIdAttachmentsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Change the compression scheme that is used to store an attachment.
pub async fn studies_id_attachments_name_compress_post(configuration: &configuration::Configuration, id: &str, name: &str) -> Result<(), Error<StudiesIdAttachmentsNameCompressPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let uri_str = format!("{}/studies/{id}/attachments/{name}/compress", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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<StudiesIdAttachmentsNameCompressPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the (binary) content of one attachment associated with the given study. The attachment will not be decompressed if `StorageCompression` is `true`.
pub async fn studies_id_attachments_name_compressed_data_get(configuration: &configuration::Configuration, id: &str, name: &str, filename: Option<&str>, content_range: Option<&str>, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameCompressedDataGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_filename = filename;
let p_content_range = content_range;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/compressed-data", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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 user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_content_range {
req_builder = req_builder.header("Content-Range", param_value.to_string());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameCompressedDataGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the MD5 hash of one attachment associated with the given study, as stored on the disk. This is different from `.../md5` iff `EnableStorage` is `true`.
pub async fn studies_id_attachments_name_compressed_md5_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameCompressedMd5GetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/compressed-md5", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameCompressedMd5GetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the size of one attachment associated with the given study, as stored on the disk. This is different from `.../size` iff `EnableStorage` is `true`.
pub async fn studies_id_attachments_name_compressed_size_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameCompressedSizeGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/compressed-size", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameCompressedSizeGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the (binary) content of one attachment associated with the given study
pub async fn studies_id_attachments_name_data_get(configuration: &configuration::Configuration, id: &str, name: &str, filename: Option<&str>, content_range: Option<&str>, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameDataGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_filename = filename;
let p_content_range = content_range;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/data", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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 user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_content_range {
req_builder = req_builder.header("Content-Range", param_value.to_string());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameDataGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete an attachment associated with the given DICOM study. This call will fail if trying to delete a system attachment (i.e. whose index is < 1024).
pub async fn studies_id_attachments_name_delete(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>) -> Result<(), Error<StudiesIdAttachmentsNameDeleteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_match = if_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_if_match {
req_builder = req_builder.header("If-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get all the information about the attachment associated with the given study
pub async fn studies_id_attachments_name_info_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameInfoGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/info", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameInfoGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Test whether the attachment has been stored as a compressed file on the disk.
pub async fn studies_id_attachments_name_is_compressed_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameIsCompressedGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/is-compressed", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameIsCompressedGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the MD5 hash of one attachment associated with the given study
pub async fn studies_id_attachments_name_md5_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameMd5GetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/md5", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameMd5GetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Attach a file to the given DICOM study. This call will fail if trying to modify a system attachment (i.e. whose index is < 1024).
pub async fn studies_id_attachments_name_put(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>, body: Option<serde_json::Value>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNamePutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_match = if_match;
let p_body = body;
let uri_str = format!("{}/studies/{id}/attachments/{name}", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_match {
req_builder = req_builder.header("If-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNamePutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the size of one attachment associated with the given study
pub async fn studies_id_attachments_name_size_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameSizeGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/attachments/{name}/size", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdAttachmentsNameSizeGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Change the compression scheme that is used to store an attachment.
pub async fn studies_id_attachments_name_uncompress_post(configuration: &configuration::Configuration, id: &str, name: &str) -> Result<(), Error<StudiesIdAttachmentsNameUncompressPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let uri_str = format!("{}/studies/{id}/attachments/{name}/uncompress", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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<StudiesIdAttachmentsNameUncompressPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Verify that the attachment is not corrupted, by validating its MD5 hash
pub async fn studies_id_attachments_name_verify_md5_post(configuration: &configuration::Configuration, id: &str, name: &str) -> Result<serde_json::Value, Error<StudiesIdAttachmentsNameVerifyMd5PostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let uri_str = format!("{}/studies/{id}/attachments/{name}/verify-md5", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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();
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<StudiesIdAttachmentsNameVerifyMd5PostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_delete(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<StudiesIdDeleteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/studies/{id}", configuration.base_path, id=crate::apis::urlencode(p_id));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &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<StudiesIdDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_get(configuration: &configuration::Configuration, id: &str, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_full = full;
let p_requested_tags = requested_tags;
let p_short = short;
let uri_str = format!("{}/studies/{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 param_value) = p_full {
req_builder = req_builder.query(&[("full", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_requested_tags {
req_builder = req_builder.query(&[("requested-tags", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶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();
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<StudiesIdGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the child instances of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_instances_get(configuration: &configuration::Configuration, id: &str, expand: Option<&str>, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdInstancesGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_expand = expand;
let p_full = full;
let p_requested_tags = requested_tags;
let p_short = short;
let uri_str = format!("{}/studies/{id}/instances", 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 param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_full {
req_builder = req_builder.query(&[("full", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_requested_tags {
req_builder = req_builder.query(&[("requested-tags", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶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();
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<StudiesIdInstancesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the tags of all the child instances of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_instances_tags_get(configuration: &configuration::Configuration, id: &str, ignore_length: Option<Vec<String>>, short: Option<bool>, simplify: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdInstancesTagsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_ignore_length = ignore_length;
let p_short = short;
let p_simplify = simplify;
let uri_str = format!("{}/studies/{id}/instances-tags", 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 param_value) = p_ignore_length {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("ignore-length".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("ignore-length", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_simplify {
req_builder = req_builder.query(&[("simplify", ¶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();
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<StudiesIdInstancesTagsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the labels that are associated with the given study (new in Orthanc 1.12.0)
pub async fn studies_id_labels_get(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<StudiesIdLabelsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/studies/{id}/labels", 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<StudiesIdLabelsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Remove a label associated with a study
pub async fn studies_id_labels_label_delete(configuration: &configuration::Configuration, id: &str, label: &str) -> Result<(), Error<StudiesIdLabelsLabelDeleteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_label = label;
let uri_str = format!("{}/studies/{id}/labels/{label}", configuration.base_path, id=crate::apis::urlencode(p_id), label=crate::apis::urlencode(p_label));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &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<StudiesIdLabelsLabelDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Test whether the study is associated with the given label
pub async fn studies_id_labels_label_get(configuration: &configuration::Configuration, id: &str, label: &str) -> Result<serde_json::Value, Error<StudiesIdLabelsLabelGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_label = label;
let uri_str = format!("{}/studies/{id}/labels/{label}", configuration.base_path, id=crate::apis::urlencode(p_id), label=crate::apis::urlencode(p_label));
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<StudiesIdLabelsLabelGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Associate a label with a study
pub async fn studies_id_labels_label_put(configuration: &configuration::Configuration, id: &str, label: &str) -> Result<(), Error<StudiesIdLabelsLabelPutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_label = label;
let uri_str = format!("{}/studies/{id}/labels/{label}", configuration.base_path, id=crate::apis::urlencode(p_id), label=crate::apis::urlencode(p_label));
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());
}
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<StudiesIdLabelsLabelPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Synchronously create a DICOMDIR media containing the DICOM study whose Orthanc identifier is provided in the URL. This flavor is synchronous, which might *not* be desirable to archive large amount of data, as it might lead to network timeouts. Prefer the asynchronous version using `POST` method.
pub async fn studies_id_media_get(configuration: &configuration::Configuration, id: &str, extended: Option<&str>, filename: Option<&str>, lossy_quality: Option<f64>, transcode: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdMediaGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_extended = extended;
let p_filename = filename;
let p_lossy_quality = lossy_quality;
let p_transcode = transcode;
let uri_str = format!("{}/studies/{id}/media", 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 param_value) = p_extended {
req_builder = req_builder.query(&[("extended", ¶m_value.to_string())]);
}
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())]);
}
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();
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<StudiesIdMediaGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a DICOMDIR media containing the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_media_post(configuration: &configuration::Configuration, id: &str, patients_id_media_post_request: Option<models::PatientsIdMediaPostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<StudiesIdMediaPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_patients_id_media_post_request = patients_id_media_post_request;
let uri_str = format!("{}/studies/{id}/media", configuration.base_path, id=crate::apis::urlencode(p_id));
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_patients_id_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<StudiesIdMediaPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Start a new job so as to move some DICOM resources into the DICOM study whose Orthanc identifier is provided in the URL: https://orthanc.uclouvain.be/book/users/anonymization.html#merging
pub async fn studies_id_merge_post(configuration: &configuration::Configuration, id: &str, studies_id_merge_post_request: Option<models::StudiesIdMergePostRequest>) -> Result<models::ModalitiesIdGetPost200Response, Error<StudiesIdMergePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_studies_id_merge_post_request = studies_id_merge_post_request;
let uri_str = format!("{}/studies/{id}/merge", configuration.base_path, id=crate::apis::urlencode(p_id));
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_studies_id_merge_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::ModalitiesIdGetPost200Response`"))),
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::ModalitiesIdGetPost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<StudiesIdMergePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the list of metadata that are associated with the given study
pub async fn studies_id_metadata_get(configuration: &configuration::Configuration, id: &str, expand: Option<&str>, numeric: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdMetadataGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_expand = expand;
let p_numeric = numeric;
let uri_str = format!("{}/studies/{id}/metadata", 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 param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_numeric {
req_builder = req_builder.query(&[("numeric", ¶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();
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<StudiesIdMetadataGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete some metadata associated with the given DICOM study. This call will fail if trying to delete a system metadata (i.e. whose index is < 1024).
pub async fn studies_id_metadata_name_delete(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>) -> Result<(), Error<StudiesIdMetadataNameDeleteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_match = if_match;
let uri_str = format!("{}/studies/{id}/metadata/{name}", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_if_match {
req_builder = req_builder.header("If-Match", param_value.to_string());
}
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<StudiesIdMetadataNameDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the value of a metadata that is associated with the given study
pub async fn studies_id_metadata_name_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<StudiesIdMetadataNameGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_none_match = if_none_match;
let uri_str = format!("{}/studies/{id}/metadata/{name}", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_none_match {
req_builder = req_builder.header("If-None-Match", param_value.to_string());
}
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<StudiesIdMetadataNameGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Set the value of some metadata in the given DICOM study. This call will fail if trying to modify a system metadata (i.e. whose index is < 1024).
pub async fn studies_id_metadata_name_put(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>, body: Option<serde_json::Value>) -> Result<(), Error<StudiesIdMetadataNamePutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let p_if_match = if_match;
let p_body = body;
let uri_str = format!("{}/studies/{id}/metadata/{name}", configuration.base_path, id=crate::apis::urlencode(p_id), name=crate::apis::urlencode(p_name));
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());
}
if let Some(param_value) = p_if_match {
req_builder = req_builder.header("If-Match", param_value.to_string());
}
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<StudiesIdMetadataNamePutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Start a job that will modify all the DICOM instances within the study whose identifier is provided in the URL. The modified DICOM instances will be stored into a brand new study, whose Orthanc identifiers will be returned by the job. https://orthanc.uclouvain.be/book/users/anonymization.html#modification-of-studies-or-series
pub async fn studies_id_modify_post(configuration: &configuration::Configuration, id: &str, patients_id_modify_post_request: Option<models::PatientsIdModifyPostRequest>) -> Result<models::ModalitiesIdGetPost200Response, Error<StudiesIdModifyPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_patients_id_modify_post_request = patients_id_modify_post_request;
let uri_str = format!("{}/studies/{id}/modify", configuration.base_path, id=crate::apis::urlencode(p_id));
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_patients_id_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::ModalitiesIdGetPost200Response`"))),
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::ModalitiesIdGetPost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<StudiesIdModifyPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the study module of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_module_get(configuration: &configuration::Configuration, id: &str, ignore_length: Option<Vec<String>>, short: Option<bool>, simplify: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdModuleGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_ignore_length = ignore_length;
let p_short = short;
let p_simplify = simplify;
let uri_str = format!("{}/studies/{id}/module", 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 param_value) = p_ignore_length {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("ignore-length".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("ignore-length", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_simplify {
req_builder = req_builder.query(&[("simplify", ¶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();
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<StudiesIdModuleGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the patient module of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_module_patient_get(configuration: &configuration::Configuration, id: &str, ignore_length: Option<Vec<String>>, short: Option<bool>, simplify: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdModulePatientGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_ignore_length = ignore_length;
let p_short = short;
let p_simplify = simplify;
let uri_str = format!("{}/studies/{id}/module-patient", 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 param_value) = p_ignore_length {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("ignore-length".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("ignore-length", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_simplify {
req_builder = req_builder.query(&[("simplify", ¶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();
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<StudiesIdModulePatientGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the parent patient of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_patient_get(configuration: &configuration::Configuration, id: &str, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdPatientGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_full = full;
let p_requested_tags = requested_tags;
let p_short = short;
let uri_str = format!("{}/studies/{id}/patient", 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 param_value) = p_full {
req_builder = req_builder.query(&[("full", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_requested_tags {
req_builder = req_builder.query(&[("requested-tags", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶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();
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<StudiesIdPatientGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Reconstruct the main DICOM tags in DB of the study whose Orthanc identifier is provided in the URL. This is useful if child studies/series/instances have inconsistent values for higher-level tags, in order to force Orthanc to use the value from the resource of interest. Beware that this is a time-consuming operation, as all the children DICOM instances will be parsed again, and the Orthanc index will be updated accordingly.
pub async fn studies_id_reconstruct_post(configuration: &configuration::Configuration, id: &str, instances_id_reconstruct_post_request: Option<models::InstancesIdReconstructPostRequest>) -> Result<(), Error<StudiesIdReconstructPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_instances_id_reconstruct_post_request = instances_id_reconstruct_post_request;
let uri_str = format!("{}/studies/{id}/reconstruct", configuration.base_path, id=crate::apis::urlencode(p_id));
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_instances_id_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<StudiesIdReconstructPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the child series of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_series_get(configuration: &configuration::Configuration, id: &str, expand: Option<&str>, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdSeriesGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_expand = expand;
let p_full = full;
let p_requested_tags = requested_tags;
let p_short = short;
let uri_str = format!("{}/studies/{id}/series", 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 param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_full {
req_builder = req_builder.query(&[("full", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_requested_tags {
req_builder = req_builder.query(&[("requested-tags", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶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();
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<StudiesIdSeriesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Extract the DICOM tags whose value is constant across all the child instances of the DICOM study whose Orthanc identifier is provided in the URL
pub async fn studies_id_shared_tags_get(configuration: &configuration::Configuration, id: &str, short: Option<bool>, simplify: Option<bool>) -> Result<serde_json::Value, Error<StudiesIdSharedTagsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_short = short;
let p_simplify = simplify;
let uri_str = format!("{}/studies/{id}/shared-tags", 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 param_value) = p_short {
req_builder = req_builder.query(&[("short", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_simplify {
req_builder = req_builder.query(&[("simplify", ¶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();
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<StudiesIdSharedTagsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Start a new job so as to split the DICOM study whose Orthanc identifier is provided in the URL, by taking some of its children series or instances out of it and putting them into a brand new study (this new study is created by setting the `StudyInstanceUID` tag to a random identifier): https://orthanc.uclouvain.be/book/users/anonymization.html#splitting
pub async fn studies_id_split_post(configuration: &configuration::Configuration, id: &str, studies_id_split_post_request: Option<models::StudiesIdSplitPostRequest>) -> Result<models::ModalitiesIdGetPost200Response, Error<StudiesIdSplitPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_studies_id_split_post_request = studies_id_split_post_request;
let uri_str = format!("{}/studies/{id}/split", configuration.base_path, id=crate::apis::urlencode(p_id));
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_studies_id_split_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::ModalitiesIdGetPost200Response`"))),
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::ModalitiesIdGetPost200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<StudiesIdSplitPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get statistics about the given study
pub async fn studies_id_statistics_get(configuration: &configuration::Configuration, id: &str) -> Result<models::StudiesIdStatisticsGet200Response, Error<StudiesIdStatisticsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/studies/{id}/statistics", 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 `models::StudiesIdStatisticsGet200Response`"))),
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::StudiesIdStatisticsGet200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<StudiesIdStatisticsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}