/*
* Stedi Enrollment
*
* The Stedi Enrollment Service manages provider enrollments with healthcare payers. It tracks enrollment status, provider details, and supports batch enrollment processing to ensure providers have the necessary credentials before processing healthcare transactions.
*
* The version of the OpenAPI document: 2024-09-01
* Contact: healthcare@stedi.com
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::enrollment::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`create_enrollment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateEnrollmentError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_enrollment_document_download`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateEnrollmentDocumentDownloadError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_enrollment_document_upload`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateEnrollmentDocumentUploadError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateProviderError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_enrollment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteEnrollmentError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_enrollment_document`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteEnrollmentDocumentError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteProviderError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`export_enrollments_csv`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExportEnrollmentsCsvError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_enrollment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetEnrollmentError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetProviderError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_enrollments`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListEnrollmentsError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_providers`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListProvidersError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_enrollment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateEnrollmentError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateProviderError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_task_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateTaskPostError {
Status400(models::ValidationExceptionResponseContent),
Status401(models::UnauthorizedExceptionResponseContent),
Status403(models::AccessDeniedExceptionResponseContent),
Status404(models::ResourceNotFoundExceptionResponseContent),
Status429(models::QuotaExceededExceptionResponseContent),
Status500(models::InternalFailureExceptionResponseContent),
Status503(models::ServiceUnavailableExceptionResponseContent),
Status504(models::GatewayTimeoutExceptionResponseContent),
UnknownValue(serde_json::Value),
}
/// Creates a new transaction enrollment request. Transaction enrollment registers a provider to exchange specific transaction types with a payer.
pub async fn create_enrollment(configuration: &configuration::Configuration, create_enrollment_request_content: models::CreateEnrollmentRequestContent) -> Result<models::CreateEnrollmentResponseContent, Error<CreateEnrollmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_create_enrollment_request_content = create_enrollment_request_content;
let uri_str = format!("{}/enrollments", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_create_enrollment_request_content);
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::CreateEnrollmentResponseContent`"))),
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::CreateEnrollmentResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateEnrollmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a pre-signed URL to download the specified enrollment document.
pub async fn create_enrollment_document_download(configuration: &configuration::Configuration, document_id: &str) -> Result<models::CreateEnrollmentDocumentDownloadResponseContent, Error<CreateEnrollmentDocumentDownloadError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_document_id = document_id;
let uri_str = format!("{}/documents/{documentId}/download", configuration.base_path, documentId=crate::enrollment::apis::urlencode(p_path_document_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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::CreateEnrollmentDocumentDownloadResponseContent`"))),
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::CreateEnrollmentDocumentDownloadResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateEnrollmentDocumentDownloadError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a pre-signed URL to upload a PDF document for the specified transaction enrollment.
pub async fn create_enrollment_document_upload(configuration: &configuration::Configuration, enrollment_id: &str, create_enrollment_document_upload_request_content: models::CreateEnrollmentDocumentUploadRequestContent) -> Result<models::CreateEnrollmentDocumentUploadResponseContent, Error<CreateEnrollmentDocumentUploadError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_enrollment_id = enrollment_id;
let p_body_create_enrollment_document_upload_request_content = create_enrollment_document_upload_request_content;
let uri_str = format!("{}/enrollments/{enrollmentId}/documents", configuration.base_path, enrollmentId=crate::enrollment::apis::urlencode(p_path_enrollment_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_create_enrollment_document_upload_request_content);
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::CreateEnrollmentDocumentUploadResponseContent`"))),
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::CreateEnrollmentDocumentUploadResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateEnrollmentDocumentUploadError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Creates a new provider record. Providers must be created before they can be enrolled with payers.
pub async fn create_provider(configuration: &configuration::Configuration, create_provider_request_content: models::CreateProviderRequestContent) -> Result<models::CreateProviderResponseContent, Error<CreateProviderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_create_provider_request_content = create_provider_request_content;
let uri_str = format!("{}/providers", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_create_provider_request_content);
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::CreateProviderResponseContent`"))),
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::CreateProviderResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateProviderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Deletes an enrollment request. Only enrollments in DRAFT status can be deleted. This operation is idempotent.
pub async fn delete_enrollment(configuration: &configuration::Configuration, enrollment_id: &str) -> Result<(), Error<DeleteEnrollmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_enrollment_id = enrollment_id;
let uri_str = format!("{}/enrollments/{enrollmentId}", configuration.base_path, enrollmentId=crate::enrollment::apis::urlencode(p_path_enrollment_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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<DeleteEnrollmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Deletes the specified PDF document associated with a transaction enrollment.
pub async fn delete_enrollment_document(configuration: &configuration::Configuration, document_id: &str) -> Result<(), Error<DeleteEnrollmentDocumentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_document_id = document_id;
let uri_str = format!("{}/documents/{documentId}", configuration.base_path, documentId=crate::enrollment::apis::urlencode(p_path_document_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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<DeleteEnrollmentDocumentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Deletes a provider record. Providers can only be deleted if they have no associated enrollments. This operation is idempotent.
pub async fn delete_provider(configuration: &configuration::Configuration, provider_id: &str) -> Result<(), Error<DeleteProviderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_provider_id = provider_id;
let uri_str = format!("{}/providers/{providerId}", configuration.base_path, providerId=crate::enrollment::apis::urlencode(p_path_provider_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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<DeleteProviderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Exports enrollment records as a CSV file with optional filtering. Supports the same filtering parameters as ListEnrollments operation. Returns a presigned URL to download the generated CSV file from S3.
pub async fn export_enrollments_csv(configuration: &configuration::Configuration, export_enrollments_csv_request_content: Option<models::ExportEnrollmentsCsvRequestContent>) -> Result<models::ExportEnrollmentsCsvResponseContent, Error<ExportEnrollmentsCsvError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_export_enrollments_csv_request_content = export_enrollments_csv_request_content;
let uri_str = format!("{}/enrollments/export", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_export_enrollments_csv_request_content);
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::ExportEnrollmentsCsvResponseContent`"))),
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::ExportEnrollmentsCsvResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ExportEnrollmentsCsvError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Retrieves an enrollment request by its ID. This operation returns the complete enrollment details including provider and payer information.
pub async fn get_enrollment(configuration: &configuration::Configuration, enrollment_id: &str) -> Result<models::GetEnrollmentResponseContent, Error<GetEnrollmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_enrollment_id = enrollment_id;
let uri_str = format!("{}/enrollments/{enrollmentId}", configuration.base_path, enrollmentId=crate::enrollment::apis::urlencode(p_path_enrollment_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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::GetEnrollmentResponseContent`"))),
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::GetEnrollmentResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetEnrollmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Retrieves a provider record by its ID. This operation returns the complete provider details including contact information.
pub async fn get_provider(configuration: &configuration::Configuration, provider_id: &str) -> Result<models::GetProviderResponseContent, Error<GetProviderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_provider_id = provider_id;
let uri_str = format!("{}/providers/{providerId}", configuration.base_path, providerId=crate::enrollment::apis::urlencode(p_path_provider_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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::GetProviderResponseContent`"))),
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::GetProviderResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetProviderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Lists transaction enrollment records with optional filtering and pagination.
pub async fn list_enrollments(configuration: &configuration::Configuration, page_size: Option<f64>, page_token: Option<&str>, filter: Option<&str>, status: Option<Vec<models::EnrollmentStatus>>, provider_npis: Option<Vec<String>>, provider_tax_ids: Option<Vec<String>>, provider_names: Option<Vec<String>>, provider_ids: Option<Vec<String>>, payer_ids: Option<Vec<String>>, sources: Option<Vec<models::EnrollmentSource>>, transactions: Option<Vec<models::TransactionType>>, created_from: Option<chrono::DateTime<chrono::FixedOffset>>, created_to: Option<chrono::DateTime<chrono::FixedOffset>>, status_updated_from: Option<chrono::DateTime<chrono::FixedOffset>>, status_updated_to: Option<chrono::DateTime<chrono::FixedOffset>>, import_id: Option<&str>, requested_effective_date_from: Option<&str>, requested_effective_date_to: Option<&str>, last_era_received_from: Option<chrono::DateTime<chrono::FixedOffset>>, last_era_received_to: Option<chrono::DateTime<chrono::FixedOffset>>, user_emails: Option<Vec<String>>, sort_by: Option<Vec<String>>) -> Result<models::ListEnrollmentsResponseContent, Error<ListEnrollmentsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_page_size = page_size;
let p_query_page_token = page_token;
let p_query_filter = filter;
let p_query_status = status;
let p_query_provider_npis = provider_npis;
let p_query_provider_tax_ids = provider_tax_ids;
let p_query_provider_names = provider_names;
let p_query_provider_ids = provider_ids;
let p_query_payer_ids = payer_ids;
let p_query_sources = sources;
let p_query_transactions = transactions;
let p_query_created_from = created_from;
let p_query_created_to = created_to;
let p_query_status_updated_from = status_updated_from;
let p_query_status_updated_to = status_updated_to;
let p_query_import_id = import_id;
let p_query_requested_effective_date_from = requested_effective_date_from;
let p_query_requested_effective_date_to = requested_effective_date_to;
let p_query_last_era_received_from = last_era_received_from;
let p_query_last_era_received_to = last_era_received_to;
let p_query_user_emails = user_emails;
let p_query_sort_by = sort_by;
let uri_str = format!("{}/enrollments", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_page_size {
req_builder = req_builder.query(&[("pageSize", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_page_token {
req_builder = req_builder.query(&[("pageToken", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_status {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_provider_npis {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("providerNpis".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("providerNpis", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_provider_tax_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("providerTaxIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("providerTaxIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_provider_names {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("providerNames".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("providerNames", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_provider_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("providerIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("providerIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_payer_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("payerIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("payerIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_sources {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sources".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("sources", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_transactions {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("transactions".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("transactions", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_created_from {
req_builder = req_builder.query(&[("createdFrom", ¶m_value.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))]);
}
if let Some(ref param_value) = p_query_created_to {
req_builder = req_builder.query(&[("createdTo", ¶m_value.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))]);
}
if let Some(ref param_value) = p_query_status_updated_from {
req_builder = req_builder.query(&[("statusUpdatedFrom", ¶m_value.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))]);
}
if let Some(ref param_value) = p_query_status_updated_to {
req_builder = req_builder.query(&[("statusUpdatedTo", ¶m_value.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))]);
}
if let Some(ref param_value) = p_query_import_id {
req_builder = req_builder.query(&[("importId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_requested_effective_date_from {
req_builder = req_builder.query(&[("requestedEffectiveDateFrom", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_requested_effective_date_to {
req_builder = req_builder.query(&[("requestedEffectiveDateTo", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_last_era_received_from {
req_builder = req_builder.query(&[("lastEraReceivedFrom", ¶m_value.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))]);
}
if let Some(ref param_value) = p_query_last_era_received_to {
req_builder = req_builder.query(&[("lastEraReceivedTo", ¶m_value.to_rfc3339_opts(chrono::SecondsFormat::Secs, true))]);
}
if let Some(ref param_value) = p_query_user_emails {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("userEmails".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("userEmails", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_sort_by {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("sortBy".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("sortBy", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").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(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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::ListEnrollmentsResponseContent`"))),
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::ListEnrollmentsResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ListEnrollmentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Lists providers with optional filtering and pagination.
pub async fn list_providers(configuration: &configuration::Configuration, page_size: Option<f64>, page_token: Option<&str>, filter: Option<&str>, provider_npis: Option<Vec<String>>, provider_tax_ids: Option<Vec<String>>) -> Result<models::ListProvidersResponseContent, Error<ListProvidersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_page_size = page_size;
let p_query_page_token = page_token;
let p_query_filter = filter;
let p_query_provider_npis = provider_npis;
let p_query_provider_tax_ids = provider_tax_ids;
let uri_str = format!("{}/providers", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_page_size {
req_builder = req_builder.query(&[("pageSize", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_page_token {
req_builder = req_builder.query(&[("pageToken", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_provider_npis {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("providerNpis".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("providerNpis", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_query_provider_tax_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("providerTaxIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("providerTaxIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").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(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
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::ListProvidersResponseContent`"))),
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::ListProvidersResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ListProvidersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Updates an existing enrollment request. Only enrollments in DRAFT status can be updated. Once an enrollment is submitted, it cannot be modified.
pub async fn update_enrollment(configuration: &configuration::Configuration, enrollment_id: &str, update_enrollment_request_content: models::UpdateEnrollmentRequestContent) -> Result<models::UpdateEnrollmentResponseContent, Error<UpdateEnrollmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_enrollment_id = enrollment_id;
let p_body_update_enrollment_request_content = update_enrollment_request_content;
let uri_str = format!("{}/enrollments/{enrollmentId}", configuration.base_path, enrollmentId=crate::enrollment::apis::urlencode(p_path_enrollment_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_update_enrollment_request_content);
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::UpdateEnrollmentResponseContent`"))),
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::UpdateEnrollmentResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateEnrollmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Updates an existing provider's information. Note that NPI and tax ID cannot be changed after creation.
pub async fn update_provider(configuration: &configuration::Configuration, provider_id: &str, update_provider_request_content: models::UpdateProviderRequestContent) -> Result<models::UpdateProviderResponseContent, Error<UpdateProviderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_provider_id = provider_id;
let p_body_update_provider_request_content = update_provider_request_content;
let uri_str = format!("{}/providers/{providerId}", configuration.base_path, providerId=crate::enrollment::apis::urlencode(p_path_provider_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_update_provider_request_content);
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::UpdateProviderResponseContent`"))),
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::UpdateProviderResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateProviderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Updates a task associated with an enrollment.
pub async fn update_task_post(configuration: &configuration::Configuration, task_id: &str, update_task_post_request_content: Option<models::UpdateTaskPostRequestContent>) -> Result<models::UpdateTaskPostResponseContent, Error<UpdateTaskPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_task_id = task_id;
let p_body_update_task_post_request_content = update_task_post_request_content;
let uri_str = format!("{}/tasks/{taskId}", configuration.base_path, taskId=crate::enrollment::apis::urlencode(p_path_task_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());
}
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let value = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
req_builder = req_builder.header("Authorization", value);
};
req_builder = req_builder.json(&p_body_update_task_post_request_content);
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::UpdateTaskPostResponseContent`"))),
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::UpdateTaskPostResponseContent`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateTaskPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}