use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
use serde::Serialize;
pub struct RadarApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Serialize)]
pub struct CreateAttemptParams {
#[serde(skip)]
pub body: RadarStandaloneAssessRequest,
}
impl CreateAttemptParams {
#[allow(deprecated)]
pub fn new(body: RadarStandaloneAssessRequest) -> Self {
Self { body }
}
}
#[derive(Debug, Clone, Serialize)]
pub struct UpdateAttemptParams {
#[serde(skip)]
pub body: RadarStandaloneUpdateRadarAttemptRequest,
}
impl UpdateAttemptParams {
#[allow(deprecated)]
pub fn new(body: RadarStandaloneUpdateRadarAttemptRequest) -> Self {
Self { body }
}
}
#[derive(Debug, Clone, Serialize)]
pub struct AddListEntryParams {
#[serde(skip)]
pub body: RadarStandaloneUpdateRadarListRequest,
}
impl AddListEntryParams {
#[allow(deprecated)]
pub fn new(body: RadarStandaloneUpdateRadarListRequest) -> Self {
Self { body }
}
}
#[derive(Debug, Clone, Serialize)]
pub struct RemoveListEntryParams {
#[serde(skip)]
pub body: RadarStandaloneDeleteRadarListEntryRequest,
}
impl RemoveListEntryParams {
#[allow(deprecated)]
pub fn new(body: RadarStandaloneDeleteRadarListEntryRequest) -> Self {
Self { body }
}
}
impl<'a> RadarApi<'a> {
pub async fn create_attempt(
&self,
params: CreateAttemptParams,
) -> Result<RadarStandaloneResponse, Error> {
self.create_attempt_with_options(params, None).await
}
pub async fn create_attempt_with_options(
&self,
params: CreateAttemptParams,
options: Option<&crate::RequestOptions>,
) -> Result<RadarStandaloneResponse, Error> {
let path = "/radar/attempts".to_string();
let method = http::Method::POST;
self.client
.request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options)
.await
}
pub async fn update_attempt(&self, id: &str, params: UpdateAttemptParams) -> Result<(), Error> {
self.update_attempt_with_options(id, params, None).await
}
pub async fn update_attempt_with_options(
&self,
id: &str,
params: UpdateAttemptParams,
options: Option<&crate::RequestOptions>,
) -> Result<(), Error> {
let id = crate::client::path_segment(id);
let path = format!("/radar/attempts/{id}");
let method = http::Method::PUT;
self.client
.request_with_body_opts_empty(method, &path, ¶ms, Some(¶ms.body), options)
.await
}
pub async fn add_list_entry(
&self,
type_: &str,
action: &str,
params: AddListEntryParams,
) -> Result<RadarListEntryAlreadyPresentResponse, Error> {
self.add_list_entry_with_options(type_, action, params, None)
.await
}
pub async fn add_list_entry_with_options(
&self,
type_: &str,
action: &str,
params: AddListEntryParams,
options: Option<&crate::RequestOptions>,
) -> Result<RadarListEntryAlreadyPresentResponse, Error> {
let type_ = crate::client::path_segment(type_);
let action = crate::client::path_segment(action);
let path = format!("/radar/lists/{type_}/{action}");
let method = http::Method::POST;
self.client
.request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options)
.await
}
pub async fn remove_list_entry(
&self,
type_: &str,
action: &str,
params: RemoveListEntryParams,
) -> Result<(), Error> {
self.remove_list_entry_with_options(type_, action, params, None)
.await
}
pub async fn remove_list_entry_with_options(
&self,
type_: &str,
action: &str,
params: RemoveListEntryParams,
options: Option<&crate::RequestOptions>,
) -> Result<(), Error> {
let type_ = crate::client::path_segment(type_);
let action = crate::client::path_segment(action);
let path = format!("/radar/lists/{type_}/{action}");
let method = http::Method::DELETE;
self.client
.request_with_body_opts_empty(method, &path, ¶ms, Some(¶ms.body), options)
.await
}
}