/*
* 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 [`series_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_anonymize_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAnonymizePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_archive_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdArchiveGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_archive_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdArchivePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_compress_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameCompressPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_compressed_data_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameCompressedDataGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_compressed_md5_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameCompressedMd5GetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_compressed_size_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameCompressedSizeGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_data_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameDataGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_info_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameInfoGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_is_compressed_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameIsCompressedGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_md5_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameMd5GetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNamePutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_size_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameSizeGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_uncompress_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameUncompressPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_attachments_name_verify_md5_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdAttachmentsNameVerifyMd5PostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_instances_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdInstancesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_instances_tags_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdInstancesTagsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_labels_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdLabelsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_labels_label_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdLabelsLabelDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_labels_label_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdLabelsLabelGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_labels_label_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdLabelsLabelPutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_media_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdMediaGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_media_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdMediaPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_metadata_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdMetadataGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_metadata_name_delete`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdMetadataNameDeleteError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_metadata_name_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdMetadataNameGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_metadata_name_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdMetadataNamePutError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_modify_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdModifyPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_module_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdModuleGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_numpy_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdNumpyGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_ordered_slices_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdOrderedSlicesGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_patient_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdPatientGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_reconstruct_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdReconstructPostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_shared_tags_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdSharedTagsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_statistics_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdStatisticsGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`series_id_study_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SeriesIdStudyGetError {
UnknownValue(serde_json::Value),
}
/// List the Orthanc identifiers of all the available DICOM series
pub async fn series_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<SeriesGetError>> {
// 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!("{}/series", 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<SeriesGetError> = 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 series whose identifier is provided in the URL. The modified DICOM instances will be stored into a brand new series, 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 series_id_anonymize_post(configuration: &configuration::Configuration, id: &str, patients_id_anonymize_post_request: Option<models::PatientsIdAnonymizePostRequest>) -> Result<models::ModalitiesIdGetPost200Response, Error<SeriesIdAnonymizePostError>> {
// 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!("{}/series/{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<SeriesIdAnonymizePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Synchronously create a ZIP archive containing the DICOM series 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 series_id_archive_get(configuration: &configuration::Configuration, id: &str, filename: Option<&str>, lossy_quality: Option<f64>, transcode: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdArchiveGetError>> {
// 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!("{}/series/{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<SeriesIdArchiveGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a ZIP archive containing the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_archive_post(configuration: &configuration::Configuration, id: &str, patients_id_archive_post_request: Option<models::PatientsIdArchivePostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<SeriesIdArchivePostError>> {
// 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!("{}/series/{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<SeriesIdArchivePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the list of attachments that are associated with the given series
pub async fn series_id_attachments_get(configuration: &configuration::Configuration, id: &str, full: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_full = full;
let uri_str = format!("{}/series/{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<SeriesIdAttachmentsGetError> = 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 series_id_attachments_name_compress_post(configuration: &configuration::Configuration, id: &str, name: &str) -> Result<(), Error<SeriesIdAttachmentsNameCompressPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let uri_str = format!("{}/series/{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<SeriesIdAttachmentsNameCompressPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the (binary) content of one attachment associated with the given series. The attachment will not be decompressed if `StorageCompression` is `true`.
pub async fn series_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<SeriesIdAttachmentsNameCompressedDataGetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameCompressedDataGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the MD5 hash of one attachment associated with the given series, as stored on the disk. This is different from `.../md5` iff `EnableStorage` is `true`.
pub async fn series_id_attachments_name_compressed_md5_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameCompressedMd5GetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameCompressedMd5GetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the size of one attachment associated with the given series, as stored on the disk. This is different from `.../size` iff `EnableStorage` is `true`.
pub async fn series_id_attachments_name_compressed_size_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameCompressedSizeGetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameCompressedSizeGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the (binary) content of one attachment associated with the given series
pub async fn series_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<SeriesIdAttachmentsNameDataGetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameDataGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete an attachment associated with the given DICOM series. This call will fail if trying to delete a system attachment (i.e. whose index is < 1024).
pub async fn series_id_attachments_name_delete(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>) -> Result<(), Error<SeriesIdAttachmentsNameDeleteError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get all the information about the attachment associated with the given series
pub async fn series_id_attachments_name_info_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameInfoGetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameInfoGetError> = 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 series_id_attachments_name_is_compressed_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameIsCompressedGetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameIsCompressedGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the MD5 hash of one attachment associated with the given series
pub async fn series_id_attachments_name_md5_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameMd5GetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameMd5GetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Attach a file to the given DICOM series. This call will fail if trying to modify a system attachment (i.e. whose index is < 1024).
pub async fn series_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<SeriesIdAttachmentsNamePutError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNamePutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the size of one attachment associated with the given series
pub async fn series_id_attachments_name_size_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameSizeGetError>> {
// 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!("{}/series/{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<SeriesIdAttachmentsNameSizeGetError> = 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 series_id_attachments_name_uncompress_post(configuration: &configuration::Configuration, id: &str, name: &str) -> Result<(), Error<SeriesIdAttachmentsNameUncompressPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let uri_str = format!("{}/series/{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<SeriesIdAttachmentsNameUncompressPostError> = 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 series_id_attachments_name_verify_md5_post(configuration: &configuration::Configuration, id: &str, name: &str) -> Result<serde_json::Value, Error<SeriesIdAttachmentsNameVerifyMd5PostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_name = name;
let uri_str = format!("{}/series/{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<SeriesIdAttachmentsNameVerifyMd5PostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_delete(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<SeriesIdDeleteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/series/{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<SeriesIdDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_get(configuration: &configuration::Configuration, id: &str, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<SeriesIdGetError>> {
// 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!("{}/series/{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<SeriesIdGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the child instances of the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_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<SeriesIdInstancesGetError>> {
// 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!("{}/series/{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<SeriesIdInstancesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the tags of all the child instances of the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_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<SeriesIdInstancesTagsGetError>> {
// 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!("{}/series/{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<SeriesIdInstancesTagsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the labels that are associated with the given series (new in Orthanc 1.12.0)
pub async fn series_id_labels_get(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<SeriesIdLabelsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/series/{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<SeriesIdLabelsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Remove a label associated with a series
pub async fn series_id_labels_label_delete(configuration: &configuration::Configuration, id: &str, label: &str) -> Result<(), Error<SeriesIdLabelsLabelDeleteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_label = label;
let uri_str = format!("{}/series/{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<SeriesIdLabelsLabelDeleteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Test whether the series is associated with the given label
pub async fn series_id_labels_label_get(configuration: &configuration::Configuration, id: &str, label: &str) -> Result<serde_json::Value, Error<SeriesIdLabelsLabelGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_label = label;
let uri_str = format!("{}/series/{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<SeriesIdLabelsLabelGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Associate a label with a series
pub async fn series_id_labels_label_put(configuration: &configuration::Configuration, id: &str, label: &str) -> Result<(), Error<SeriesIdLabelsLabelPutError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_label = label;
let uri_str = format!("{}/series/{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<SeriesIdLabelsLabelPutError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Synchronously create a DICOMDIR media containing the DICOM series 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 series_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<SeriesIdMediaGetError>> {
// 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!("{}/series/{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<SeriesIdMediaGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Create a DICOMDIR media containing the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_media_post(configuration: &configuration::Configuration, id: &str, patients_id_media_post_request: Option<models::PatientsIdMediaPostRequest>) -> Result<models::PatientsIdArchivePost200Response, Error<SeriesIdMediaPostError>> {
// 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!("{}/series/{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<SeriesIdMediaPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the list of metadata that are associated with the given series
pub async fn series_id_metadata_get(configuration: &configuration::Configuration, id: &str, expand: Option<&str>, numeric: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdMetadataGetError>> {
// 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!("{}/series/{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<SeriesIdMetadataGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Delete some metadata associated with the given DICOM series. This call will fail if trying to delete a system metadata (i.e. whose index is < 1024).
pub async fn series_id_metadata_name_delete(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>) -> Result<(), Error<SeriesIdMetadataNameDeleteError>> {
// 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!("{}/series/{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<SeriesIdMetadataNameDeleteError> = 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 series
pub async fn series_id_metadata_name_get(configuration: &configuration::Configuration, id: &str, name: &str, if_none_match: Option<&str>) -> Result<serde_json::Value, Error<SeriesIdMetadataNameGetError>> {
// 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!("{}/series/{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<SeriesIdMetadataNameGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Set the value of some metadata in the given DICOM series. This call will fail if trying to modify a system metadata (i.e. whose index is < 1024).
pub async fn series_id_metadata_name_put(configuration: &configuration::Configuration, id: &str, name: &str, if_match: Option<&str>, body: Option<serde_json::Value>) -> Result<(), Error<SeriesIdMetadataNamePutError>> {
// 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!("{}/series/{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<SeriesIdMetadataNamePutError> = 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 series whose identifier is provided in the URL. The modified DICOM instances will be stored into a brand new series, 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 series_id_modify_post(configuration: &configuration::Configuration, id: &str, patients_id_modify_post_request: Option<models::PatientsIdModifyPostRequest>) -> Result<models::ModalitiesIdGetPost200Response, Error<SeriesIdModifyPostError>> {
// 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!("{}/series/{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<SeriesIdModifyPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get the series module of the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_module_get(configuration: &configuration::Configuration, id: &str, ignore_length: Option<Vec<String>>, short: Option<bool>, simplify: Option<bool>) -> Result<serde_json::Value, Error<SeriesIdModuleGetError>> {
// 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!("{}/series/{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<SeriesIdModuleGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Decode the given DICOM series, for use with numpy in Python. The numpy array has 4 dimensions: (frame, height, width, color channel).
pub async fn series_id_numpy_get(configuration: &configuration::Configuration, id: &str, compress: Option<bool>, rescale: Option<bool>) -> Result<serde_json::Value, Error<SeriesIdNumpyGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let p_compress = compress;
let p_rescale = rescale;
let uri_str = format!("{}/series/{id}/numpy", 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_compress {
req_builder = req_builder.query(&[("compress", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_rescale {
req_builder = req_builder.query(&[("rescale", ¶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<SeriesIdNumpyGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Sort the instances and frames (slices) of the DICOM series whose Orthanc identifier is provided in the URL. This URI is essentially used by the Orthanc Web viewer and by the Osimis Web viewer.
pub async fn series_id_ordered_slices_get(configuration: &configuration::Configuration, id: &str) -> Result<models::SeriesIdOrderedSlicesGet200Response, Error<SeriesIdOrderedSlicesGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/series/{id}/ordered-slices", 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::SeriesIdOrderedSlicesGet200Response`"))),
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::SeriesIdOrderedSlicesGet200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SeriesIdOrderedSlicesGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the parent patient of the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_patient_get(configuration: &configuration::Configuration, id: &str, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<SeriesIdPatientGetError>> {
// 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!("{}/series/{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<SeriesIdPatientGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Reconstruct the main DICOM tags in DB of the series 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 series_id_reconstruct_post(configuration: &configuration::Configuration, id: &str, instances_id_reconstruct_post_request: Option<models::InstancesIdReconstructPostRequest>) -> Result<(), Error<SeriesIdReconstructPostError>> {
// 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!("{}/series/{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<SeriesIdReconstructPostError> = 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 series whose Orthanc identifier is provided in the URL
pub async fn series_id_shared_tags_get(configuration: &configuration::Configuration, id: &str, short: Option<bool>, simplify: Option<bool>) -> Result<serde_json::Value, Error<SeriesIdSharedTagsGetError>> {
// 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!("{}/series/{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<SeriesIdSharedTagsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get statistics about the given series
pub async fn series_id_statistics_get(configuration: &configuration::Configuration, id: &str) -> Result<models::SeriesIdStatisticsGet200Response, Error<SeriesIdStatisticsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_id = id;
let uri_str = format!("{}/series/{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::SeriesIdStatisticsGet200Response`"))),
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::SeriesIdStatisticsGet200Response`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SeriesIdStatisticsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Get detailed information about the parent study of the DICOM series whose Orthanc identifier is provided in the URL
pub async fn series_id_study_get(configuration: &configuration::Configuration, id: &str, full: Option<bool>, requested_tags: Option<&str>, short: Option<bool>) -> Result<serde_json::Value, Error<SeriesIdStudyGetError>> {
// 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!("{}/series/{id}/study", 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<SeriesIdStudyGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}