/*
* CrowdStrike API Specification
*
* Use this API specification as a reference for the API endpoints you can use to interact with your Falcon environment. These endpoints support authentication via OAuth2 and interact with detections and network containment. For detailed usage guides and examples, see our [documentation inside the Falcon console](https://falcon.crowdstrike.com/support/documentation). To use the APIs described below, combine the base URL with the path shown for each API endpoint. For commercial cloud customers, your base URL is `https://api.crowdstrike.com`. Each API endpoint requires authorization via an OAuth2 token. Your first API request should retrieve an OAuth2 token using the `oauth2/token` endpoint, such as `https://api.crowdstrike.com/oauth2/token`. For subsequent requests, include the OAuth2 token in an HTTP authorization header. Tokens expire after 30 minutes, after which you should make a new token request to continue making API requests.
*
* The version of the OpenAPI document: rolling
*
* Generated by: https://openapi-generator.tech
*/
use super::{ContentType, Error, configuration};
use crate::{apis::ResponseContent, models};
use reqwest;
use serde::de::Error as _;
/// struct for typed errors of method [`batch_active_responder_cmd`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BatchActiveResponderCmdError {
Status400(models::DomainApiError),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`batch_cmd`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BatchCmdError {
Status400(models::DomainApiError),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`batch_get_cmd`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BatchGetCmdError {
Status400(models::DomainApiError),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`batch_get_cmd_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BatchGetCmdStatusError {
Status400(models::DomainApiError),
Status403(models::MsaErrorsOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`batch_init_sessions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BatchInitSessionsError {
Status400(models::DomainApiError),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`batch_refresh_sessions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BatchRefreshSessionsError {
Status400(models::DomainApiError),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_aggregate_sessions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrAggregateSessionsError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_check_active_responder_command_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrCheckActiveResponderCommandStatusError {
Status401(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_check_command_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrCheckCommandStatusError {
Status401(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_delete_file`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrDeleteFileError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_delete_file_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrDeleteFileV2Error {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_delete_queued_session`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrDeleteQueuedSessionError {
Status400(models::DomainApiError),
Status401(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_delete_session`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrDeleteSessionError {
Status400(models::DomainApiError),
Status401(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_execute_active_responder_command`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrExecuteActiveResponderCommandError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_execute_command`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrExecuteCommandError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_get_extracted_file_contents`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrGetExtractedFileContentsError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_init_session`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrInitSessionError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_list_all_sessions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrListAllSessionsError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_list_files`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrListFilesError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_list_files_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrListFilesV2Error {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_list_queued_sessions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrListQueuedSessionsError {
Status400(models::DomainApiError),
Status401(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_list_sessions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrListSessionsError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status404(models::DomainApiError),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`r_tr_pulse_session`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RTrPulseSessionError {
Status400(models::DomainApiError),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainApiError),
UnknownValue(serde_json::Value),
}
pub async fn batch_active_responder_cmd(
configuration: &configuration::Configuration,
body: models::DomainBatchExecuteCommandRequest,
timeout: Option<i32>,
timeout_duration: Option<&str>,
host_timeout_duration: Option<&str>,
) -> Result<models::DomainMultiCommandExecuteResponseWrapper, Error<BatchActiveResponderCmdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let p_query_host_timeout_duration = host_timeout_duration;
let uri_str = format!(
"{}/real-time-response/combined/batch-active-responder-command/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_host_timeout_duration {
req_builder = req_builder.query(&[("host_timeout_duration", ¶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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainMultiCommandExecuteResponseWrapper`",
)));
}
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::DomainMultiCommandExecuteResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<BatchActiveResponderCmdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn batch_cmd(
configuration: &configuration::Configuration,
body: models::DomainBatchExecuteCommandRequest,
timeout: Option<i32>,
timeout_duration: Option<&str>,
host_timeout_duration: Option<&str>,
) -> Result<models::DomainMultiCommandExecuteResponseWrapper, Error<BatchCmdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let p_query_host_timeout_duration = host_timeout_duration;
let uri_str = format!(
"{}/real-time-response/combined/batch-command/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_host_timeout_duration {
req_builder = req_builder.query(&[("host_timeout_duration", ¶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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainMultiCommandExecuteResponseWrapper`",
)));
}
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::DomainMultiCommandExecuteResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<BatchCmdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn batch_get_cmd(
configuration: &configuration::Configuration,
body: models::DomainBatchGetCommandRequest,
timeout: Option<i32>,
timeout_duration: Option<&str>,
host_timeout_duration: Option<&str>,
) -> Result<models::DomainBatchGetCommandResponse, Error<BatchGetCmdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let p_query_host_timeout_duration = host_timeout_duration;
let uri_str = format!(
"{}/real-time-response/combined/batch-get-command/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_host_timeout_duration {
req_builder = req_builder.query(&[("host_timeout_duration", ¶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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainBatchGetCommandResponse`",
)));
}
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::DomainBatchGetCommandResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<BatchGetCmdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn batch_get_cmd_status(
configuration: &configuration::Configuration,
batch_get_cmd_req_id: &str,
timeout: Option<i32>,
timeout_duration: Option<&str>,
) -> Result<models::DomainBatchGetCmdStatusResponse, Error<BatchGetCmdStatusError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_batch_get_cmd_req_id = batch_get_cmd_req_id;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let uri_str = format!(
"{}/real-time-response/combined/batch-get-command/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶m_value.to_string())]);
}
req_builder = req_builder.query(&[(
"batch_get_cmd_req_id",
&p_query_batch_get_cmd_req_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::DomainBatchGetCmdStatusResponse`",
)));
}
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::DomainBatchGetCmdStatusResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<BatchGetCmdStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn batch_init_sessions(
configuration: &configuration::Configuration,
body: models::DomainBatchInitSessionRequest,
timeout: Option<i32>,
timeout_duration: Option<&str>,
host_timeout_duration: Option<&str>,
) -> Result<models::DomainBatchInitSessionResponse, Error<BatchInitSessionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let p_query_host_timeout_duration = host_timeout_duration;
let uri_str = format!(
"{}/real-time-response/combined/batch-init-session/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_host_timeout_duration {
req_builder = req_builder.query(&[("host_timeout_duration", ¶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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainBatchInitSessionResponse`",
)));
}
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::DomainBatchInitSessionResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<BatchInitSessionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn batch_refresh_sessions(
configuration: &configuration::Configuration,
body: models::DomainBatchRefreshSessionRequest,
timeout: Option<i32>,
timeout_duration: Option<&str>,
) -> Result<models::DomainBatchRefreshSessionResponse, Error<BatchRefreshSessionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let uri_str = format!(
"{}/real-time-response/combined/batch-refresh-session/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainBatchRefreshSessionResponse`",
)));
}
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::DomainBatchRefreshSessionResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<BatchRefreshSessionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_aggregate_sessions(
configuration: &configuration::Configuration,
body: Vec<models::MsaAggregateQueryRequest>,
) -> Result<models::MsaAggregatesResponse, Error<RTrAggregateSessionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/real-time-response/aggregates/sessions/GET/v1",
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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::MsaAggregatesResponse`",
)));
}
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::MsaAggregatesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrAggregateSessionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_check_active_responder_command_status(
configuration: &configuration::Configuration,
cloud_request_id: &str,
sequence_id: i32,
) -> Result<models::DomainStatusResponseWrapper, Error<RTrCheckActiveResponderCommandStatusError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_cloud_request_id = cloud_request_id;
let p_query_sequence_id = sequence_id;
let uri_str = format!(
"{}/real-time-response/entities/active-responder-command/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("cloud_request_id", &p_query_cloud_request_id.to_string())]);
req_builder = req_builder.query(&[("sequence_id", &p_query_sequence_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::DomainStatusResponseWrapper`",
)));
}
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::DomainStatusResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrCheckActiveResponderCommandStatusError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_check_command_status(
configuration: &configuration::Configuration,
cloud_request_id: &str,
sequence_id: i32,
) -> Result<models::DomainStatusResponseWrapper, Error<RTrCheckCommandStatusError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_cloud_request_id = cloud_request_id;
let p_query_sequence_id = sequence_id;
let uri_str = format!(
"{}/real-time-response/entities/command/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("cloud_request_id", &p_query_cloud_request_id.to_string())]);
req_builder = req_builder.query(&[("sequence_id", &p_query_sequence_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::DomainStatusResponseWrapper`",
)));
}
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::DomainStatusResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrCheckCommandStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_delete_file(
configuration: &configuration::Configuration,
ids: &str,
session_id: &str,
) -> Result<models::MsaReplyMetaOnly, Error<RTrDeleteFileError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let p_query_session_id = session_id;
let uri_str = format!(
"{}/real-time-response/entities/file/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("ids", &p_query_ids.to_string())]);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::MsaReplyMetaOnly`",
)));
}
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::MsaReplyMetaOnly`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrDeleteFileError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_delete_file_v2(
configuration: &configuration::Configuration,
ids: &str,
session_id: &str,
) -> Result<models::MsaReplyMetaOnly, Error<RTrDeleteFileV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let p_query_session_id = session_id;
let uri_str = format!(
"{}/real-time-response/entities/file/v2",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("ids", &p_query_ids.to_string())]);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::MsaReplyMetaOnly`",
)));
}
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::MsaReplyMetaOnly`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrDeleteFileV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_delete_queued_session(
configuration: &configuration::Configuration,
session_id: &str,
cloud_request_id: &str,
) -> Result<models::MsaspecQueryResponse, Error<RTrDeleteQueuedSessionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_session_id = session_id;
let p_query_cloud_request_id = cloud_request_id;
let uri_str = format!(
"{}/real-time-response/entities/queued-sessions/command/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.to_string())]);
req_builder = req_builder.query(&[("cloud_request_id", &p_query_cloud_request_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::MsaspecQueryResponse`",
)));
}
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::MsaspecQueryResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrDeleteQueuedSessionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_delete_session(
configuration: &configuration::Configuration,
session_id: &str,
) -> Result<models::MsaReplyMetaOnly, Error<RTrDeleteSessionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_session_id = session_id;
let uri_str = format!(
"{}/real-time-response/entities/sessions/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::MsaReplyMetaOnly`",
)));
}
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::MsaReplyMetaOnly`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrDeleteSessionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_execute_active_responder_command(
configuration: &configuration::Configuration,
body: models::DomainCommandExecuteRequest,
) -> Result<models::DomainCommandExecuteResponseWrapper, Error<RTrExecuteActiveResponderCommandError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/real-time-response/entities/active-responder-command/v1",
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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainCommandExecuteResponseWrapper`",
)));
}
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::DomainCommandExecuteResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrExecuteActiveResponderCommandError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_execute_command(
configuration: &configuration::Configuration,
body: models::DomainCommandExecuteRequest,
) -> Result<models::DomainCommandExecuteResponseWrapper, Error<RTrExecuteCommandError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/real-time-response/entities/command/v1",
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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainCommandExecuteResponseWrapper`",
)));
}
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::DomainCommandExecuteResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrExecuteCommandError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_get_extracted_file_contents(
configuration: &configuration::Configuration,
session_id: &str,
sha256: &str,
filename: Option<&str>,
) -> Result<Vec<i32>, Error<RTrGetExtractedFileContentsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_session_id = session_id;
let p_query_sha256 = sha256;
let p_query_filename = filename;
let uri_str = format!(
"{}/real-time-response/entities/extracted-file-contents/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.to_string())]);
req_builder = req_builder.query(&[("sha256", &p_query_sha256.to_string())]);
if let Some(ref param_value) = p_query_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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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 `Vec<i32>`",
)));
}
ContentType::Unsupported(unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{unknown_type}` content type response that cannot be converted to `Vec<i32>`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrGetExtractedFileContentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_init_session(
configuration: &configuration::Configuration,
body: models::DomainInitRequest,
timeout: Option<i32>,
timeout_duration: Option<&str>,
) -> Result<models::DomainInitResponseWrapper, Error<RTrInitSessionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let p_query_timeout = timeout;
let p_query_timeout_duration = timeout_duration;
let uri_str = format!(
"{}/real-time-response/entities/sessions/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_query_timeout {
req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_timeout_duration {
req_builder = req_builder.query(&[("timeout_duration", ¶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(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainInitResponseWrapper`",
)));
}
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::DomainInitResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrInitSessionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_list_all_sessions(
configuration: &configuration::Configuration,
offset: Option<&str>,
limit: Option<i32>,
sort: Option<&str>,
filter: Option<&str>,
) -> Result<models::DomainListSessionsResponseMsa, Error<RTrListAllSessionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let p_query_filter = filter;
let uri_str = format!(
"{}/real-time-response/queries/sessions/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶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 user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::DomainListSessionsResponseMsa`",
)));
}
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::DomainListSessionsResponseMsa`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrListAllSessionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_list_files(
configuration: &configuration::Configuration,
session_id: &str,
) -> Result<models::DomainListFilesResponseWrapper, Error<RTrListFilesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_session_id = session_id;
let uri_str = format!(
"{}/real-time-response/entities/file/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::DomainListFilesResponseWrapper`",
)));
}
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::DomainListFilesResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrListFilesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_list_files_v2(
configuration: &configuration::Configuration,
session_id: &str,
) -> Result<models::DomainListFilesV2ResponseWrapper, Error<RTrListFilesV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_session_id = session_id;
let uri_str = format!(
"{}/real-time-response/entities/file/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("session_id", &p_query_session_id.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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
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::DomainListFilesV2ResponseWrapper`",
)));
}
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::DomainListFilesV2ResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrListFilesV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_list_queued_sessions(
configuration: &configuration::Configuration,
body: models::MsaIdsRequest,
) -> Result<models::DomainQueuedSessionResponseWrapper, Error<RTrListQueuedSessionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/real-time-response/entities/queued-sessions/GET/v1",
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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainQueuedSessionResponseWrapper`",
)));
}
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::DomainQueuedSessionResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrListQueuedSessionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_list_sessions(
configuration: &configuration::Configuration,
body: models::MsaIdsRequest,
) -> Result<models::DomainSessionResponseWrapper, Error<RTrListSessionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/real-time-response/entities/sessions/GET/v1",
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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainSessionResponseWrapper`",
)));
}
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::DomainSessionResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrListSessionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn r_tr_pulse_session(
configuration: &configuration::Configuration,
body: models::DomainInitRequest,
) -> Result<models::DomainInitResponseWrapper, Error<RTrPulseSessionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/real-time-response/entities/refresh-session/v1",
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 token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_body_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 `models::DomainInitResponseWrapper`",
)));
}
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::DomainInitResponseWrapper`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RTrPulseSessionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}